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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 03:17:24 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:

Okay, so the root cause isn't BTC = 1, since LLE does operate on loops with BTC = 1, after versioning them. The root cause is that certain dependencies that were previously unknown (in this case `findStoreToLoadDependences` returns no candidates, and LLE bails out before versioning) are now correctly analyzed.  LLE is actually more powerful in this case, and I'm tempted to classify the regression in #96656 as invalid. Will update that bug with all the information and close this PR.

Again, sorry for the confusion. I got confused from the different outputs of llvm-reduce with loop-versioning and loop-load-elim in the pipeline.

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


More information about the llvm-commits mailing list