diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-11-29 21:09:36 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-11-29 21:09:36 +0000 |
| commit | 02507fdead4d86a04c1c914549b2d2ab295c47c7 (patch) | |
| tree | c8458215ae4d4302a34b1a319d3a28eb35e88042 /lib/Analysis/MemoryDependenceAnalysis.cpp | |
| parent | 7719b59199b6920ada130675f658bf3ec8521cd6 (diff) | |
| download | external_llvm-02507fdead4d86a04c1c914549b2d2ab295c47c7.zip external_llvm-02507fdead4d86a04c1c914549b2d2ab295c47c7.tar.gz external_llvm-02507fdead4d86a04c1c914549b2d2ab295c47c7.tar.bz2 | |
Fix a really nasty caching bug I introduced in memdep. An entry
was being added to the Result vector, but not being put in the
cache. This means that if the cache was reused wholesale for a
later query that it would be missing this entry and we'd do an
incorrect load elimination.
Unfortunately, it's not really possible to write a useful
testcase for this, but this unbreaks 255.vortex.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90093 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
| -rw-r--r-- | lib/Analysis/MemoryDependenceAnalysis.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index b5069ec..49dfeb5 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -1156,8 +1156,18 @@ 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; continue; } |
