diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-10-23 18:37:11 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-10-23 18:37:11 +0000 |
commit | 5858b56ce352683909f29088cc9d9d02359f7011 (patch) | |
tree | 2536f7fb3d6fb1490aad631f62ab3db18c618ef3 /llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | |
parent | b8097dec8fa62d7d930c7375e1373bf1fbd714bc (diff) | |
download | bcm5719-llvm-5858b56ce352683909f29088cc9d9d02359f7011.tar.gz bcm5719-llvm-5858b56ce352683909f29088cc9d9d02359f7011.zip |
Ignore unreachable blocks when doing memory dependence analysis on non-local
loads. It's not really profitable and may result in GVN going into an infinite
loop when it hits constructs like this:
%x = gep %some.type %x, ...
Found via an LTO build of LLVM.
llvm-svn: 166490
Diffstat (limited to 'llvm/lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index 9316df6fbf2..98728904945 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -983,7 +983,7 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, for (NonLocalDepInfo::iterator I = Cache->begin(), E = Cache->end(); I != E; ++I) { Visited.insert(std::make_pair(I->getBB(), Addr)); - if (!I->getResult().isNonLocal()) + if (!I->getResult().isNonLocal() && DT->isReachableFromEntry(I->getBB())) Result.push_back(NonLocalDepResult(I->getBB(), I->getResult(), Addr)); } ++NumCacheCompleteNonLocalPtr; @@ -1029,7 +1029,7 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer, NumSortedEntries); // If we got a Def or Clobber, add this to the list of results. - if (!Dep.isNonLocal()) { + if (!Dep.isNonLocal() && DT->isReachableFromEntry(BB)) { Result.push_back(NonLocalDepResult(BB, Dep, Pointer.getAddr())); continue; } |