[PATCH] D49156: [MemorySSA] Add API to update MemoryPhis, following CFG changes.
Alina Sbirlea via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 12 14:19:32 PDT 2018
asbirlea added inline comments.
================
Comment at: lib/Analysis/MemorySSAUpdater.cpp:517
+ Phi->unorderedDeleteIncoming(Idx);
+ Idx = Phi->getBasicBlockIndex(Pred);
+ }
----------------
george.burgess.iv wrote:
> Looks like we could do this in O(`Preds.size() + Phi->getNumOperands()`) time if we instead used a `SmallPtrSet` for `Preds` and did a single walk over the operands list, querying the `SmallPtrSet` for whether $current_operand is something we could remove.
>
> If we made a general utility for Phis similar in spirit to `llvm::erase_if` for this, looks like we could even make `unorderedDeleteIncomingBlock` and `unorderedDeleteIncomingValue` tiny wrappers around that.
>
> It would arguably be mildly awkward to have the `addIncoming` side-effect from the lambda there, but I'd imagine it would be cleaner on the whole. WDYT?
I think I like this more than the alternatives I thought about. So here goes :)
Repository:
rL LLVM
https://reviews.llvm.org/D49156
More information about the llvm-commits
mailing list