Change MemDep::getNonLocalDependency to return its results as

a smallvector instead of a DenseMap.  This speeds up GVN by 5%
on 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60255 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2008-11-29 21:33:22 +00:00
parent 729b23758a
commit 396a4a55e5
3 changed files with 13 additions and 13 deletions

View File

@@ -104,8 +104,10 @@ getCallSiteDependency(CallSite C, BasicBlock::iterator ScanIt,
/// This method assumes the instruction returns a "nonlocal" dependency
/// within its own block.
///
void MemoryDependenceAnalysis::getNonLocalDependency(Instruction *QueryInst,
DenseMap<BasicBlock*, MemDepResult> &Result) {
void MemoryDependenceAnalysis::
getNonLocalDependency(Instruction *QueryInst,
SmallVectorImpl<std::pair<BasicBlock*,
MemDepResult> > &Result) {
assert(getDependency(QueryInst).isNonLocal() &&
"getNonLocalDependency should only be used on insts with non-local deps!");
DenseMap<BasicBlock*, DepResultTy> &Cache = NonLocalDeps[QueryInst];
@@ -128,10 +130,7 @@ void MemoryDependenceAnalysis::getNonLocalDependency(Instruction *QueryInst,
} else {
// Seed DirtyBlocks with each of the preds of QueryInst's block.
BasicBlock *QueryBB = QueryInst->getParent();
// FIXME: use range insertion/append.
for (pred_iterator PI = pred_begin(QueryBB), E = pred_end(QueryBB);
PI != E; ++PI)
DirtyBlocks.push_back(*PI);
DirtyBlocks.append(pred_begin(QueryBB), pred_end(QueryBB));
NumUncacheNonlocal++;
}
@@ -173,7 +172,7 @@ void MemoryDependenceAnalysis::getNonLocalDependency(Instruction *QueryInst,
// Copy the result into the output set.
for (DenseMap<BasicBlock*, DepResultTy>::iterator I = Cache.begin(),
E = Cache.end(); I != E; ++I)
Result[I->first] = ConvToResult(I->second);
Result.push_back(std::make_pair(I->first, ConvToResult(I->second)));
}
/// getDependency - Return the instruction on which a memory operation