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

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 16:43:26 PDT 2016


reames added inline comments.

================
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;
+
----------------
chandlerc wrote:
> 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.
FYI: I ended up using a SmallDenseMap<Loop*, SmallVector<BasicBlock *,1>>.  Trying to use the TinyPtrVector didn't work out well because the getExitBlocks function takes a SmallVectorImpl.  

Honestly, it also seems like TinyPtrVector should be an implementation detail of SmallVector<T, 1>.  


Repository:
  rL LLVM

https://reviews.llvm.org/D24509





More information about the llvm-commits mailing list