[PATCH] D14526: Don't recompute LCSSA after loop-unrolling when possible.

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 10 09:49:16 PST 2015


joker.eph added inline comments.

================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:233
@@ -224,1 +232,3 @@
+    }
+  }
 
----------------
 `LI->getLoopFor(BB) != ParentL; ` could be written `ParentL->contains(BB)`;

Also, as an alternative to the raw loop: 

```
 bool AllExitsAreInsideParentLoop = std::all_of(ExitBlocks.begin(), ExitBlocks.end(), [&] (BasicBlock *BB) { return ParentL->contains(BB); })
```



================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:567
@@ -556,2 +566,3 @@
 
-      formLCSSARecursively(*OuterL, *DT, LI, SE);
+      if (CompletelyUnroll && !AllExitsAreInsideParentLoop)
+        formLCSSARecursively(*OuterL, *DT, LI, SE);
----------------
Are we sure that there is no case where partial unrolling can break the LCSSA form for the enclosing loop? I don't think so but not sure why or if it is an implementation guarantee that can be lost?
Also, are we allowed to break LCSSA for the current loop in case of partial unrolling? I.e. if I have a pass manager that contains unrolling + another loop pass, and the second expect LCSSA form for every loop, it seems your patch could change that (unless partial unrolling guarantee LCSSA on the partially unrolled loop as well).


http://reviews.llvm.org/D14526





More information about the llvm-commits mailing list