[llvm-commits] [llvm] r67971 - in /llvm/trunk: include/llvm/Analysis/MemoryDependenceAnalysis.h lib/Analysis/MemoryDependenceAnalysis.cpp
Chris Lattner
sabre at nondot.org
Sat Mar 28 17:24:04 PDT 2009
Author: lattner
Date: Sat Mar 28 19:24:04 2009
New Revision: 67971
URL: http://llvm.org/viewvc/llvm-project?rev=67971&view=rev
Log:
now that you can put a PointerIntPair in a SmallPtrSet, remove some
hackish workarounds from memdep
Modified:
llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
Modified: llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h?rev=67971&r1=67970&r2=67971&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h Sat Mar 28 19:24:04 2009
@@ -171,9 +171,8 @@
CachedNonLocalPointerInfo NonLocalPointerDeps;
// A map from instructions to their non-local pointer dependencies.
- // The elements of the SmallPtrSet are ValueIsLoadPair's.
typedef DenseMap<Instruction*,
- SmallPtrSet<void*, 4> > ReverseNonLocalPtrDepTy;
+ SmallPtrSet<ValueIsLoadPair, 4> > ReverseNonLocalPtrDepTy;
ReverseNonLocalPtrDepTy ReverseNonLocalPtrDeps;
Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=67971&r1=67970&r2=67971&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Sat Mar 28 19:24:04 2009
@@ -86,9 +86,9 @@
/// 'Inst's set in ReverseMap. If the set becomes empty, remove Inst's entry.
template <typename KeyTy>
static void RemoveFromReverseMap(DenseMap<Instruction*,
- SmallPtrSet<KeyTy*, 4> > &ReverseMap,
- Instruction *Inst, KeyTy *Val) {
- typename DenseMap<Instruction*, SmallPtrSet<KeyTy*, 4> >::iterator
+ SmallPtrSet<KeyTy, 4> > &ReverseMap,
+ Instruction *Inst, KeyTy Val) {
+ typename DenseMap<Instruction*, SmallPtrSet<KeyTy, 4> >::iterator
InstIt = ReverseMap.find(Inst);
assert(InstIt != ReverseMap.end() && "Reverse map out of sync?");
bool Found = InstIt->second.erase(Val);
@@ -560,8 +560,7 @@
// Eliminating the dirty entry from 'Cache', so update the reverse info.
ValueIsLoadPair CacheKey(Pointer, isLoad);
- RemoveFromReverseMap(ReverseNonLocalPtrDeps, ScanPos,
- CacheKey.getOpaqueValue());
+ RemoveFromReverseMap(ReverseNonLocalPtrDeps, ScanPos, CacheKey);
} else {
++NumUncacheNonLocalPtr;
}
@@ -588,7 +587,7 @@
Instruction *Inst = Dep.getInst();
assert(Inst && "Didn't depend on anything?");
ValueIsLoadPair CacheKey(Pointer, isLoad);
- ReverseNonLocalPtrDeps[Inst].insert(CacheKey.getOpaqueValue());
+ ReverseNonLocalPtrDeps[Inst].insert(CacheKey);
return Dep;
}
@@ -827,7 +826,7 @@
assert(I->second.isNonLocal() &&
"Should only be here with transparent block");
I->second = MemDepResult::getClobber(BB->begin());
- ReverseNonLocalPtrDeps[BB->begin()].insert(CacheKey.getOpaqueValue());
+ ReverseNonLocalPtrDeps[BB->begin()].insert(CacheKey);
Result.push_back(*I);
break;
}
@@ -883,7 +882,7 @@
assert(Target->getParent() == PInfo[i].first);
// Eliminating the dirty entry from 'Cache', so update the reverse info.
- RemoveFromReverseMap(ReverseNonLocalPtrDeps, Target, P.getOpaqueValue());
+ RemoveFromReverseMap(ReverseNonLocalPtrDeps, Target, P);
}
// Remove P from NonLocalPointerDeps (which deletes NonLocalDepInfo).
@@ -1030,13 +1029,12 @@
ReverseNonLocalPtrDepTy::iterator ReversePtrDepIt =
ReverseNonLocalPtrDeps.find(RemInst);
if (ReversePtrDepIt != ReverseNonLocalPtrDeps.end()) {
- SmallPtrSet<void*, 4> &Set = ReversePtrDepIt->second;
+ SmallPtrSet<ValueIsLoadPair, 4> &Set = ReversePtrDepIt->second;
SmallVector<std::pair<Instruction*, ValueIsLoadPair>,8> ReversePtrDepsToAdd;
- for (SmallPtrSet<void*, 4>::iterator I = Set.begin(), E = Set.end();
- I != E; ++I) {
- ValueIsLoadPair P;
- P.setFromOpaqueValue(*I);
+ for (SmallPtrSet<ValueIsLoadPair, 4>::iterator I = Set.begin(),
+ E = Set.end(); I != E; ++I) {
+ ValueIsLoadPair P = *I;
assert(P.getPointer() != RemInst &&
"Already removed NonLocalPointerDeps info for RemInst");
@@ -1066,7 +1064,7 @@
while (!ReversePtrDepsToAdd.empty()) {
ReverseNonLocalPtrDeps[ReversePtrDepsToAdd.back().first]
- .insert(ReversePtrDepsToAdd.back().second.getOpaqueValue());
+ .insert(ReversePtrDepsToAdd.back().second);
ReversePtrDepsToAdd.pop_back();
}
}
@@ -1126,10 +1124,10 @@
E = ReverseNonLocalPtrDeps.end(); I != E; ++I) {
assert(I->first != D && "Inst occurs in rev NLPD map");
- for (SmallPtrSet<void*, 4>::const_iterator II = I->second.begin(),
+ for (SmallPtrSet<ValueIsLoadPair, 4>::const_iterator II = I->second.begin(),
E = I->second.end(); II != E; ++II)
- assert(*II != ValueIsLoadPair(D, false).getOpaqueValue() &&
- *II != ValueIsLoadPair(D, true).getOpaqueValue() &&
+ assert(*II != ValueIsLoadPair(D, false) &&
+ *II != ValueIsLoadPair(D, true) &&
"Inst occurs in ReverseNonLocalPtrDeps map");
}
More information about the llvm-commits
mailing list