[llvm] [LSR] Clean up code using SCEVPatternMatch (NFC) (PR #145556)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 06:30:40 PDT 2025
================
@@ -3333,14 +3331,12 @@ static bool canFoldIVIncExpr(const SCEV *IncExpr, Instruction *UserInst,
IncOffset = Immediate::getFixed(IncConst->getValue()->getSExtValue());
} else {
// Look for mul(vscale, constant), to detect a scalable offset.
- auto *IncVScale = dyn_cast<SCEVMulExpr>(IncExpr);
- if (!IncVScale || IncVScale->getNumOperands() != 2 ||
- !isa<SCEVVScale>(IncVScale->getOperand(1)))
- return false;
- auto *Scale = dyn_cast<SCEVConstant>(IncVScale->getOperand(0));
- if (!Scale || Scale->getType()->getScalarSizeInBits() > 64)
+ const APInt *C;
+ const SCEV *Op1;
+ if (!match(IncExpr, m_scev_Mul(m_scev_APInt(C), m_SCEV(Op1))) ||
+ !isa<SCEVVScale>(Op1) || C->getSignificantBits() > 64)
----------------
fhahn wrote:
ditto, having m_SCEVVScale would also remove the need to define `Op1`.
https://github.com/llvm/llvm-project/pull/145556
More information about the llvm-commits
mailing list