[PATCH] D48372: [MemorySSAUpdater] Remove deleted trivial Phis from active workset

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 21 11:46:57 PDT 2018


efriedma added inline comments.


================
Comment at: lib/Analysis/MemorySSAUpdater.cpp:208
   if (Phi) {
+    InsertedPHIs.remove(Phi);
     Phi->replaceAllUsesWith(Same);
----------------
labrinea wrote:
> efriedma wrote:
> > remove on a SmallSetVector is linear time, which might be a problem here.
> On a SmallVector we'd have to do a linear lookup and then move the elements around, so it should be the same in terms of complexity. Moreover, I thought it's good to have a guarantee that InsertedPHIs does not contain duplicates. What is the suggestion here?
It's possible to construct a set with both constant-time removal and iteration in insertion order: essentially, make a `DenseMap<AssertingVH<MemoryPhi>, size_t>` where the value is an index into a `SmallVector<Optional<AssertingVH<MemoryPhi>>>`), or something like that.  Or maybe there's some simpler way to handle this I'm not thinking of.


https://reviews.llvm.org/D48372





More information about the llvm-commits mailing list