diff options
author | Owen Anderson <resistor@mac.com> | 2007-07-25 21:26:36 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2007-07-25 21:26:36 +0000 |
commit | 3dfcf33cf897b04c95e252bbd645e9930f608701 (patch) | |
tree | 40f24116ef3957d4a35c7e7e47e269c80b777b08 /lib/Analysis/MemoryDependenceAnalysis.cpp | |
parent | 2e3d6b4a273f12a9121a040da1f9dcdccf88cba1 (diff) | |
download | external_llvm-3dfcf33cf897b04c95e252bbd645e9930f608701.zip external_llvm-3dfcf33cf897b04c95e252bbd645e9930f608701.tar.gz external_llvm-3dfcf33cf897b04c95e252bbd645e9930f608701.tar.bz2 |
Fix a bug in non-local memdep that was causing an infinite loop on 175.vpr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40495 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r-- | lib/Analysis/MemoryDependenceAnalysis.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index ae26c26..e260b27 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -103,7 +103,8 @@ Instruction* MemoryDependenceAnalysis::getCallSiteDependency(CallSite C, Instruc bool MemoryDependenceAnalysis::nonLocalHelper(Instruction* query, BasicBlock* block, - DenseMap<BasicBlock*, Value*>& resp) { + DenseMap<BasicBlock*, Value*>& resp, + SmallPtrSet<BasicBlock*, 4>& visited) { if (resp.count(block)) return resp[block] != None; @@ -113,10 +114,15 @@ bool MemoryDependenceAnalysis::nonLocalHelper(Instruction* query, return true; } + visited.insert(block); + bool inserted = false; for (pred_iterator PI = pred_begin(block), PE = pred_end(block); PI != PE; ++PI) - inserted |= nonLocalHelper(query, *PI, resp); + if (!visited.count(*PI)) + inserted |= nonLocalHelper(query, *PI, resp, visited); + + visited.erase(block); if (!inserted) resp.insert(std::make_pair(block, None)); @@ -133,11 +139,14 @@ bool MemoryDependenceAnalysis::getNonLocalDependency(Instruction* query, } bool inserted = false; + SmallPtrSet<BasicBlock*, 4> visited; + visited.insert(query->getParent()); BasicBlock* parent = query->getParent(); for (pred_iterator PI = pred_begin(parent), PE = pred_end(parent); PI != PE; ++PI) { - inserted |= nonLocalHelper(query, *PI, resp); + if (!visited.count(*PI)) + inserted |= nonLocalHelper(query, *PI, resp, visited); } if (!inserted) |