diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp index 8ddffe34bdb8c5..6ead851033d0d8 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -340,9 +340,9 @@ static Instruction *foldShiftOfShiftedLogic(BinaryOperator &I, // TODO: Remove the one-use check if the other logic operand (Y) is constant. Value *X, *Y; auto matchFirstShift = [&](Value *V) { - return !isa(V) && + BinaryOperator *BO; + return match(V, m_BinOp(BO)) && BO->getOpcode() == ShiftOpcode && match(V, m_OneUse(m_Shift(m_Value(X), m_APInt(C0)))) && - cast(V)->getOpcode() == ShiftOpcode && (*C0 + *C1).ult(Ty->getScalarSizeInBits()); };