From dd895d559f3c368c018b77eddfa8f314b65a7ce1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 30 Nov 2009 02:26:29 +0000 Subject: [PATCH] reapply r90093 with an addition of keeping the forward and reverse nonlocal memdep maps in synch, this should fix 255.vortex. llvm-svn: 90107 --- lib/Analysis/MemoryDependenceAnalysis.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index b5069ecbc92..21baf427ea4 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -1156,8 +1156,21 @@ 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); + Cache->insert(It, Entry); + Cache = 0; + + // Add it to the reverse map next. + ReverseNonLocalPtrDeps[Pred->getTerminator()].insert(CacheKey); continue; }