[PATCH] D21951: [LVI] Use DenseMap::find_as in LazyValueInfo.

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 26 13:14:44 PDT 2016


rnk added inline comments.

================
Comment at: lib/Analysis/LazyValueInfo.cpp:417-418
@@ -389,4 +416,4 @@
     /// memory overhead.
     typedef SmallDenseMap<AssertingVH<BasicBlock>, LVILatticeVal, 4>
         ValueCacheEntryTy;
 
----------------
This type is probably too large to use with DenseMap. I would expect that the keys would end up spaced out in memory, making lookup more expensive. Maybe try using a separate allocation for the value like this:
  struct ValueCacheEntryTy {
    LVIValueHandle Handle;
    SmallDenseMap<AssertingVH<BasicBlock>, LVILatticeVal, 4> BBs;
  };
  DenseMap<Value *, std::unique_ptr<ValueCacheEntryTy>> ValueCache;

On the other hand, maybe your 2% win is from avoiding separate allocation overhead. This is probably worth a quick benchmark, though.


https://reviews.llvm.org/D21951





More information about the llvm-commits mailing list