diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-01 07:33:32 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-01 07:33:32 +0000 |
commit | 855d9da596062b5742a27d9d96c38528120f391b (patch) | |
tree | 869b35328131f8f1a8158366bf5b52b65f35757f /lib/Analysis/MemoryDependenceAnalysis.cpp | |
parent | 49f5389aae459c32a4b2e3c970643d22de3473b7 (diff) |
fix 255.vortex again, third time's the charm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90217 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r-- | lib/Analysis/MemoryDependenceAnalysis.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index b5069ecbc9..ae6f970eff 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -1156,8 +1156,41 @@ getNonLocalPointerDepFromBB(Value *Pointer, uint64_t PointeeSize, // that predecessor. We can still do PRE of the load, which would insert // a computation of the pointer in this predecessor. if (PredPtr == 0) { - Result.push_back(NonLocalDepEntry(Pred, - MemDepResult::getClobber(Pred->getTerminator()))); + // Add the entry to the Result list. + NonLocalDepEntry Entry(Pred, + MemDepResult::getClobber(Pred->getTerminator())); + Result.push_back(Entry); + + // Add it to the cache for this CacheKey so that subsequent queries get + // this result. + Cache = &NonLocalPointerDeps[CacheKey].second; + MemoryDependenceAnalysis::NonLocalDepInfo::iterator It = + std::upper_bound(Cache->begin(), Cache->end(), Entry); + + if (It != Cache->begin() && prior(It)->first == Pred) + --It; + + if (It == Cache->end() || It->first != Pred) { + Cache->insert(It, Entry); + // Add it to the reverse map. + ReverseNonLocalPtrDeps[Pred->getTerminator()].insert(CacheKey); + } else if (!It->second.isDirty()) { + // noop + } else if (It->second.getInst() == Pred->getTerminator()) { + // Same instruction, clear the dirty marker. + It->second = Entry.second; + } else if (It->second.getInst() == 0) { + // Dirty, with no instruction, just add this. + It->second = Entry.second; + ReverseNonLocalPtrDeps[Pred->getTerminator()].insert(CacheKey); + } else { + // Otherwise, dirty with a different instruction. + RemoveFromReverseMap(ReverseNonLocalPtrDeps, It->second.getInst(), + CacheKey); + It->second = Entry.second; + ReverseNonLocalPtrDeps[Pred->getTerminator()].insert(CacheKey); + } + Cache = 0; continue; } |