[llvm] LoopLoadElim: don't version single-iteration loops (PR #97599)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 10:18:47 PDT 2024


================
@@ -598,10 +598,11 @@ class LoadEliminationForLoop {
       }
 
       // Point of no-return, start the transformation.  First, version the loop
-      // if necessary.
-
-      LoopVersioning LV(LAI, Checks, L, LI, DT, PSE.getSE());
-      LV.versionLoop();
+      // if it's not a single-iteration loop.
+      if (!PSE.getBackedgeTakenCount()->isOne()) {
----------------
artagnon wrote:

Here's the Alive2 proof for the transformation in the test: https://alive2.llvm.org/ce/z/fKWdPi.

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


More information about the llvm-commits mailing list