Skip to content

Commit c68a06b

Browse files
committed
[DAGCombiner] Simplify ShAmt alignment in ReduceLoadOpStoreWidth. NFC
The expression used to align ShAmt to a multiple of NewBW in ReduceLoadOpStoreWidth was difficult to understand if (ShAmt % NewBW) ShAmt = (((ShAmt + NewBW - 1) / NewBW) * NewBW) - NewBW; We can just to like this instead ShAmt = ShAmt - (ShAmt % NewBW);
1 parent a608607 commit c68a06b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20357,10 +20357,9 @@ SDValue DAGCombiner::ReduceLoadOpStoreWidth(SDNode *N) {
2035720357
if (NewBW >= BitWidth)
2035820358
return SDValue();
2035920359

20360-
// If the lsb changed does not start at the type bitwidth boundary,
20361-
// start at the previous one.
20362-
if (ShAmt % NewBW)
20363-
ShAmt = (((ShAmt + NewBW - 1) / NewBW) * NewBW) - NewBW;
20360+
// If the lsb that is modified does not start at the type bitwidth boundary,
20361+
// align to start at the previous boundary.
20362+
ShAmt = ShAmt - (ShAmt % NewBW);
2036420363
APInt Mask = APInt::getBitsSet(BitWidth, ShAmt,
2036520364
std::min(BitWidth, ShAmt + NewBW));
2036620365
if ((Imm & Mask) == Imm) {

0 commit comments

Comments
 (0)