[NFC][InstCombine] Some more preparatory cleanup for dropRedundantMaskingOfLeftShiftInput()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375153 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/InstCombine/InstCombineShifts.cpp b/lib/Transforms/InstCombine/InstCombineShifts.cpp
index 11b7a16..cc0e35e 100644
--- a/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -158,8 +158,8 @@
assert(OuterShift->getOpcode() == Instruction::BinaryOps::Shl &&
"The input must be 'shl'!");
- Value *Masked = OuterShift->getOperand(0);
- Value *ShiftShAmt = OuterShift->getOperand(1);
+ Value *Masked, *ShiftShAmt;
+ match(OuterShift, m_Shift(m_Value(Masked), m_Value(ShiftShAmt)));
Type *NarrowestTy = OuterShift->getType();
Type *WidestTy = Masked->getType();
@@ -252,8 +252,8 @@
}
// No 'NUW'/'NSW'! We no longer know that we won't shift-out non-0 bits.
- auto *NewShift =
- BinaryOperator::Create(OuterShift->getOpcode(), X, ShiftShAmt);
+ auto *NewShift = BinaryOperator::Create(OuterShift->getOpcode(), X,
+ OuterShift->getOperand(1));
if (!NeedMask)
return NewShift;