diff options
| author | Alina Sbirlea <asbirlea@google.com> | 2019-10-10 20:43:06 +0000 |
|---|---|---|
| committer | Alina Sbirlea <asbirlea@google.com> | 2019-10-10 20:43:06 +0000 |
| commit | 67f0c5c085782aa6cf36b2253b83b04351215343 (patch) | |
| tree | 86c1304af800e464d022c9d1c45da4206396c9d6 /llvm/lib/Analysis | |
| parent | 7c562f12869f8eb11f08d1617e199e0909ce9761 (diff) | |
| download | bcm5719-llvm-67f0c5c085782aa6cf36b2253b83b04351215343.tar.gz bcm5719-llvm-67f0c5c085782aa6cf36b2253b83b04351215343.zip | |
[MemorySSA] Additional handling of unreachable blocks.
Summary:
Whenever we get the previous definition, the assumption is that the
recursion starts ina reachable block.
If the recursion starts in an unreachable block, we may recurse
indefinitely. Handle this case by returning LoE if the block is
unreachable.
Resolves PR43426.
Reviewers: george.burgess.iv
Subscribers: Prazek, sanjoy.google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68809
llvm-svn: 374447
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/MemorySSAUpdater.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/MemorySSAUpdater.cpp b/llvm/lib/Analysis/MemorySSAUpdater.cpp index 78e197aad55..ce74c708df1 100644 --- a/llvm/lib/Analysis/MemorySSAUpdater.cpp +++ b/llvm/lib/Analysis/MemorySSAUpdater.cpp @@ -48,6 +48,10 @@ MemoryAccess *MemorySSAUpdater::getPreviousDefRecursive( return Cached->second; } + // If this method is called from an unreachable block, return LoE. + if (!MSSA->DT->isReachableFromEntry(BB)) + return MSSA->getLiveOnEntryDef(); + if (BasicBlock *Pred = BB->getSinglePredecessor()) { // Single predecessor case, just recurse, we can only have one definition. MemoryAccess *Result = getPreviousDefFromEnd(Pred, CachedPreviousDef); |

