[llvm] [SCEV] Improve applyLoopGuards to support Mul (PR #83428)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 7 00:54:37 PST 2024
================
@@ -15208,11 +15212,8 @@ const SCEV *ScalarEvolution::applyLoopGuards(const SCEV *Expr, const Loop *L) {
auto *MulRHS = Mul->getOperand(1);
if (isa<SCEVConstant>(MulLHS))
std::swap(MulLHS, MulRHS);
- if (auto *Div = dyn_cast<SCEVUDivExpr>(MulLHS))
- if (Div->getOperand(1) == MulRHS) {
- DividesBy = MulRHS;
- return true;
- }
----------------
nikic wrote:
Ah I see. That does indeed make it safe. In that case I think only the comment above this block needs adjustment -- it still talks about looking for `(A /u B) * B`, while now you're looking for just `A * B`. Could also clarify that this just detects a candidate that is later verified.
https://github.com/llvm/llvm-project/pull/83428
More information about the llvm-commits
mailing list