Skip to content

Commit 31a691e

Browse files
committed
[NFC][InstCombine] Some more preparatory cleanup for dropRedundantMaskingOfLeftShiftInput()
llvm-svn: 375153
1 parent 8a3d7c9 commit 31a691e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ dropRedundantMaskingOfLeftShiftInput(BinaryOperator *OuterShift,
158158
assert(OuterShift->getOpcode() == Instruction::BinaryOps::Shl &&
159159
"The input must be 'shl'!");
160160

161-
Value *Masked = OuterShift->getOperand(0);
162-
Value *ShiftShAmt = OuterShift->getOperand(1);
161+
Value *Masked, *ShiftShAmt;
162+
match(OuterShift, m_Shift(m_Value(Masked), m_Value(ShiftShAmt)));
163163

164164
Type *NarrowestTy = OuterShift->getType();
165165
Type *WidestTy = Masked->getType();
@@ -252,8 +252,8 @@ dropRedundantMaskingOfLeftShiftInput(BinaryOperator *OuterShift,
252252
}
253253

254254
// No 'NUW'/'NSW'! We no longer know that we won't shift-out non-0 bits.
255-
auto *NewShift =
256-
BinaryOperator::Create(OuterShift->getOpcode(), X, ShiftShAmt);
255+
auto *NewShift = BinaryOperator::Create(OuterShift->getOpcode(), X,
256+
OuterShift->getOperand(1));
257257

258258
if (!NeedMask)
259259
return NewShift;

0 commit comments

Comments
 (0)