[PATCH] D21665: [LoopSimplify] Update LCSSA after separating nested loops.

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 00:57:30 PDT 2016


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

lgtm with nits


================
Comment at: lib/Transforms/Utils/LoopSimplify.cpp:331
@@ -329,1 +330,3 @@
+  SmallSetVector<BasicBlock *, 8> OuterLoopBlocks;
+  OuterLoopBlocks.insert(NewBB);
   // Now that we know which blocks are in L and which need to be moved to
----------------
Can't this just be a `SmallVector` ?

================
Comment at: lib/Transforms/Utils/LoopSimplify.cpp:384
@@ +383,3 @@
+            continue;
+          formLCSSAForInstruction(*L, *OpI, *DT, ExitBlocks, PredCache, LI);
+        }
----------------
How about avoiding repeated calls to `formLCSSAForInstruction` on the same instruction using a set?

Given that you'll now send in a worklist of instructions anyway, maybe just unique that worklist before sending it in?

================
Comment at: lib/Transforms/Utils/LoopSimplify.cpp:594
@@ +593,3 @@
+    if (any_of(predecessors(ExitBlock),
+               [L](BasicBlock *BB) { return !L->contains(BB); })) {
+      rewriteLoopExitBlock(L, ExitBlock, DT, LI, PreserveLCSSA);
----------------
I was asking to use `any_of` instead of the loop you added. :)

If you want to clean this up also, that's fine too of course. :)


https://reviews.llvm.org/D21665





More information about the llvm-commits mailing list