Currently SmallSet<PointerTy> inherits from SmallPtrSet<PointerTy>. This
patch replaces such types with SmallPtrSet, because IMO it is slightly
clearer and allows us to get rid of unnecessarily including SmallSet.h
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Seems OK to me - but not necessarily a strong motivation. Is the SmallPtr header dependency a significant impact? Would it be easier for to go the other way & normalize/standardize on SmallSet everywhere, if it reasonably does the right thing for pointers?
SmallSet<T*> has a template specialization that just inherits from SmallPtrSet.
As to the question about giong the other direction and using SmallSet everywehre. The real SmallSet class doesn't implement begin/end while SmallPtrSet does so we shouldn't convert everything that direction.
*nod* So my question was "why ever write SmallPtrSet, why not just write SmallSet<T*> everywhere"?
As to the question about giong the other direction and using SmallSet everywehre. The real SmallSet class doesn't implement begin/end while SmallPtrSet does so we shouldn't convert everything that direction.
Oh, that's curious - though I'm going to guess that there's at least some uses that don't distinguish between how they name the type when they use begin/end, they probably just use it and it works.
In fact there is at least one place that iterates while using the SmallSet specialization on a pointer. It's DAGCombiner::MatchLoadCombine. Why is that not changed by this patch?
Yeah, I am not really sure there is a strong reason to change it. I just went for SmallPtrSet, because it is much wider used than SmallSet. And using SmallPtrSetImpl<> & on a SmallSet looks suprising.