diff options
author | Alina Sbirlea <asbirlea@google.com> | 2019-05-02 23:41:58 +0000 |
---|---|---|
committer | Alina Sbirlea <asbirlea@google.com> | 2019-05-02 23:41:58 +0000 |
commit | 0363c3b8bbf1c72e7a7da65444a8095cdc63f32d (patch) | |
tree | 07164a49b71070fb5d30a572dd065825985b2f97 /llvm/lib/Analysis/MemorySSAUpdater.cpp | |
parent | f7d3048e5b90c9d71ea462a721efce360260fd60 (diff) | |
download | llvm-0363c3b8bbf1c72e7a7da65444a8095cdc63f32d.zip llvm-0363c3b8bbf1c72e7a7da65444a8095cdc63f32d.tar.gz llvm-0363c3b8bbf1c72e7a7da65444a8095cdc63f32d.tar.bz2 |
[MemorySSA] Check that block is reachable when adding phis.
Summary:
Originally the insertDef method was only used when building MemorySSA, and was limiting the number of Phi nodes that it created.
Now it's used for updates as well, and it can create additional Phis needed for correctness.
Make sure no Phis are created in unreachable blocks (condition met during MSSA build), otherwise the renamePass will find a null DTNode.
Resolves PR41640.
Reviewers: george.burgess.iv
Subscribers: jlebar, Prazek, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D61410
llvm-svn: 359845
Diffstat (limited to 'llvm/lib/Analysis/MemorySSAUpdater.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemorySSAUpdater.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/MemorySSAUpdater.cpp b/llvm/lib/Analysis/MemorySSAUpdater.cpp index 7c675b7..8fe7c68 100644 --- a/llvm/lib/Analysis/MemorySSAUpdater.cpp +++ b/llvm/lib/Analysis/MemorySSAUpdater.cpp @@ -72,7 +72,10 @@ MemoryAccess *MemorySSAUpdater::getPreviousDefRecursive( // potential phi node. This will insert phi nodes if we cycle in order to // break the cycle and have an operand. for (auto *Pred : predecessors(BB)) - PhiOps.push_back(getPreviousDefFromEnd(Pred, CachedPreviousDef)); + if (MSSA->DT->isReachableFromEntry(Pred)) + PhiOps.push_back(getPreviousDefFromEnd(Pred, CachedPreviousDef)); + else + PhiOps.push_back(MSSA->getLiveOnEntryDef()); // Now try to simplify the ops to avoid placing a phi. // This may return null if we never created a phi yet, that's okay |