[PATCH] D24509: [LCSSA] Cache LoopExits to avoid wasted work

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 15 22:46:46 PDT 2016


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

LGTM, Feel free to submit with the tweak below.


================
Comment at: lib/Transforms/Utils/LCSSA.cpp:70-73
@@ -70,1 +69,6 @@
 
+  // Cache the Loop ExitBlocks across this loop.  We expect to get a lot of
+  // instructions within the same loops, computing the exit blocks is
+  // expensive, and we're not mutating the loop structure.
+  DenseMap<Loop*, SmallVector<BasicBlock *, 8>> LoopExitBlocks;
+
----------------
Nice!

What about using a SmallDenseMap and TinyPtrVector here with a small size of 4 or so? Seems likely to make the common case a bit lighter weight.


https://reviews.llvm.org/D24509





More information about the llvm-commits mailing list