[PATCH] D28549: Global DCE performance improvement

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 02:40:13 PST 2017

mehdi_amini added inline comments.

Comment at: include/llvm/Transforms/IPO/GlobalDCE.h:41
+  // Constant -> Globals that use this global cache.
+  std::unordered_map<Constant *, SmallPtrSet<GlobalValue *, 8>>
+      ConstantDependenciesCache;
serge-sans-paille wrote:
> mehdi_amini wrote:
> > majnemer wrote:
> > > DenseMap?
> > DenseMap with a `SmallPtrSet`? 
> I've kept the original Moving to a std::unordered_multimap for GVDEpendencies, not sure about what you expect for the ConstantDependenciesCache. What's the pro/con of using a DenseMap?
DenseMap is an open-addressing hashmap where the bucket are allocated with the key, hence "dense". This is very performance but for the memory consumption: empty buckets are taking the same amount of space as occupied ones.
So we usually avoid DenseMap containing "large" elements.



More information about the llvm-commits mailing list