aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/MemoryDependenceAnalysis.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-29 21:33:22 +0000
committerChris Lattner <sabre@nondot.org>2008-11-29 21:33:22 +0000
commit396a4a55e535728e2023aa331401c1a2b782cb9a (patch)
treee9c42da488ffab8912bda577f6877aea10ba4f5c /lib/Analysis/MemoryDependenceAnalysis.cpp
parent729b23758ab990a7bd07ceb5ac6af04c32f40a76 (diff)
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
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r--lib/Analysis/MemoryDependenceAnalysis.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp
index f59be5ec03..099d43492c 100644
--- a/lib/Analysis/MemoryDependenceAnalysis.cpp
+++ b/lib/Analysis/MemoryDependenceAnalysis.cpp
@@ -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