[llvm] change contents of ScalarEvolution from private to protected (PR #83052)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 20 17:03:39 PDT 2024


================
@@ -9184,15 +9246,19 @@ ScalarEvolution::ExitLimit ScalarEvolution::computeExitLimitFromICmp(
     if (EL.hasAnyInfo()) return EL;
     break;
   }
+
   case ICmpInst::ICMP_SLE:
   case ICmpInst::ICMP_ULE:
-    // Since the loop is finite, an invariant RHS cannot include the boundary
-    // value, otherwise it would loop forever.
-    if (!EnableFiniteLoopControl || !ControllingFiniteLoop ||
-        !isLoopInvariant(RHS, L))
-      break;
-    RHS = getAddExpr(getOne(RHS->getType()), RHS);
+    if (!AssumeLoopFinite) {
+      // Since the loop is finite, an invariant RHS cannot include the boundary
+      // value, otherwise it would loop forever.
+      if (!EnableFiniteLoopControl || !ControllingFiniteLoop ||
+          !isLoopInvariant(RHS, L))
+        break;
+      RHS = getAddExpr(getOne(RHS->getType()), RHS);
----------------
efriedma-quic wrote:

The assignment to RHS should be outside the "if"?

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


More information about the llvm-commits mailing list