[PATCH] D46426: [SROA] Handle PHI with multiple duplicate predecessors

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 16 14:13:57 PDT 2018


efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: lib/Transforms/Scalar/SROA.cpp:1273
+        HI = Handled.find(Pred);
+    if (HI != Handled.end()) {
+      assert(HI->second.first == InVal &&
----------------
bjope wrote:
> efriedma wrote:
> > DenseMap has a method "lookup" you can use to avoid the iterator.
> So if I have a
> ```
> DenseMap<BasicBlock*, Value*> Map;
> ```
> can I do
> 
> ```
> Value* V = Map.lookup(Pred);
> ```
> and expect to get a null pointer in case Pred isn't found?
> 
Yes, lookup() returns null if the key isn't in the map.


Repository:
  rL LLVM

https://reviews.llvm.org/D46426





More information about the llvm-commits mailing list