[llvm] 556316c - [InstCombine] foldShiftOfShiftedLogic - replace cast<BinaryOperator> with m_BinOp matcher. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 06:10:25 PDT 2020
Author: Simon Pilgrim
Date: 2020-10-09T14:10:12+01:00
New Revision: 556316cf724e5a2c569f07a5e04d27e2ff1a6c66
URL: https://github.com/llvm/llvm-project/commit/556316cf724e5a2c569f07a5e04d27e2ff1a6c66
DIFF: https://github.com/llvm/llvm-project/commit/556316cf724e5a2c569f07a5e04d27e2ff1a6c66.diff
LOG: [InstCombine] foldShiftOfShiftedLogic - replace cast<BinaryOperator> with m_BinOp matcher. NFCI.
Allows us to drop the !isa<ConstantExpr> check.
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
index 8ddffe34bdb8..6ead851033d0 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<ConstantExpr>(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<BinaryOperator>(V)->getOpcode() == ShiftOpcode &&
(*C0 + *C1).ult(Ty->getScalarSizeInBits());
};
More information about the llvm-commits
mailing list