[llvm] [SCEV] Improve applyLoopGuards to support Mul (PR #83428)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 6 07:24:20 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;
-              }
----------------
komalon1 wrote:

This part only tries to find a pattern of a SCEV. It used to search for a more complicated pattern of (X / constant)*constant, but now only a SCEVMul with a constant is enough. This is, BTW, what improved the trip-count-minmax.ll tests. It doesn't change the original SCEV, just searches for an information in it.

https://github.com/llvm/llvm-project/pull/83428


More information about the llvm-commits mailing list