MemorySSAUpdater: Only add phis to insertedphis if we actually inserted them, not...
authorDaniel Berlin <dberlin@dberlin.org>
Wed, 27 Sep 2017 05:35:19 +0000 (05:35 +0000)
committerDaniel Berlin <dberlin@dberlin.org>
Wed, 27 Sep 2017 05:35:19 +0000 (05:35 +0000)
llvm-svn: 314273

llvm/lib/Analysis/MemorySSAUpdater.cpp

index 1ff8447..f28f8bd 100644 (file)
@@ -85,12 +85,11 @@ MemoryAccess *MemorySSAUpdater::getPreviousDefRecursive(BasicBlock *BB) {
         unsigned i = 0;
         for (auto *Pred : predecessors(BB))
           Phi->addIncoming(PhiOps[i++], Pred);
+        InsertedPHIs.push_back(Phi);
       }
-
       Result = Phi;
     }
-    if (MemoryPhi *MP = dyn_cast<MemoryPhi>(Result))
-      InsertedPHIs.push_back(MP);
+
     // Set ourselves up for the next variable by resetting visited state.
     VisitedBlocks.erase(BB);
     return Result;