[llvm-commits] [llvm] r62868 - /llvm/branches/Apple/Dib/lib/Analysis/MemoryDependenceAnalysis.cpp
Bill Wendling
isanbard at gmail.com
Fri Jan 23 11:36:32 PST 2009
Author: void
Date: Fri Jan 23 13:36:31 2009
New Revision: 62868
URL: http://llvm.org/viewvc/llvm-project?rev=62868&view=rev
Log:
Pull r62757/r62822/r62838/r62839 into Dib. This brings
MemoryDependenceAnalysis.cpp up to TOT.
Modified:
llvm/branches/Apple/Dib/lib/Analysis/MemoryDependenceAnalysis.cpp
Modified: llvm/branches/Apple/Dib/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=62868&r1=62867&r2=62868&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Analysis/MemoryDependenceAnalysis.cpp Fri Jan 23 13:36:31 2009
@@ -751,10 +751,9 @@
// cache remains sorted. Sort it now (if needed) so that recursive
// invocations of getNonLocalPointerDepFromBB that could reuse the cache
// value will only see properly sorted cache arrays.
- if (NumSortedEntries != Cache->size()) {
+ if (Cache && NumSortedEntries != Cache->size())
std::sort(Cache->begin(), Cache->end());
- NumSortedEntries = Cache->size();
- }
+ Cache = 0;
// FIXME: it is entirely possible that PHI translating will end up with
// the same value. Consider PHI translating something like:
@@ -767,12 +766,12 @@
Result, Visited))
goto PredTranslationFailure;
}
-
+
// Refresh the CacheInfo/Cache pointer so that it isn't invalidated.
CacheInfo = &NonLocalPointerDeps[CacheKey];
Cache = &CacheInfo->second;
NumSortedEntries = Cache->size();
-
+
// Since we did phi translation, the "Cache" set won't contain all of the
// results for the query. This is ok (we can still use it to accelerate
// specific block queries) but we can't do the fastpath "return all
@@ -789,10 +788,16 @@
// cerr << "OP:\t\t\t\t" << *PtrInst->getOperand(0);
PredTranslationFailure:
- // Refresh the CacheInfo/Cache pointer so that it isn't invalidated.
- CacheInfo = &NonLocalPointerDeps[CacheKey];
- Cache = &CacheInfo->second;
-
+ if (Cache == 0) {
+ // Refresh the CacheInfo/Cache pointer if it got invalidated.
+ CacheInfo = &NonLocalPointerDeps[CacheKey];
+ Cache = &CacheInfo->second;
+ NumSortedEntries = Cache->size();
+ } else if (NumSortedEntries != Cache->size()) {
+ std::sort(Cache->begin(), Cache->end());
+ NumSortedEntries = Cache->size();
+ }
+
// Since we did phi translation, the "Cache" set won't contain all of the
// results for the query. This is ok (we can still use it to accelerate
// specific block queries) but we can't do the fastpath "return all
@@ -821,7 +826,7 @@
break;
}
}
-
+
// Okay, we're done now. If we added new values to the cache, re-sort it.
switch (Cache->size()-NumSortedEntries) {
case 0:
@@ -1045,6 +1050,10 @@
if (Instruction *NewDirtyInst = NewDirtyVal.getInst())
ReversePtrDepsToAdd.push_back(std::make_pair(NewDirtyInst, P));
}
+
+ // Re-sort the NonLocalDepInfo. Changing the dirty entry to its
+ // subsequent value may invalidate the sortedness.
+ std::sort(NLPDI.begin(), NLPDI.end());
}
ReverseNonLocalPtrDeps.erase(ReversePtrDepIt);
More information about the llvm-commits
mailing list