[PATCH] D11481: [LoopUnswitch] Improve loop unswitch pass to find trivial unswitch conditions more effectively

Bjarke Hammersholt Roune broune at google.com
Fri Jul 24 12:29:44 PDT 2015

broune accepted this revision.
broune added a comment.
This revision is now accepted and ready to land.


Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:744
@@ -745,7 +743,3 @@
-/// TryTrivialLoopUnswitch - Check if loop header block's terminator is a trivial
-/// unswitch condition: that is, the condition controls whether or not the loop
-/// does anything at all (which means it can only occur in loop header). If it is
-/// a trivial condition, unswitching produces no code duplications (equivalently,
-/// it produces a simpler loop and a new empty loop, which gets deleted). Therefore
-/// always unswitch trivial condition.
+/// TryTrivialLoopUnswitch - Check if the first non-constant condition from the loop
+/// header is a trivial unswitch condition: that is, a condition controls whether
Nit: This is correct in the sense of "starting from", but could also be read as "from within". I'd use "starting from" to clarify it.

Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:760
@@ +759,3 @@
+  // the successor as well. Because in theory these successors could be
+  // fused to loop header block. The reason to not constant fold
+  // conditions and merge blocks in LoopUnswitch pass is that it could
Nit: Now that you are not specifying that this function only looks in the loop header, there is no need to justify looking at successors by saying that they could be seen as part of the loop header.


More information about the llvm-commits mailing list