mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-16 16:37:42 +00:00
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:
parent
729b23758a
commit
396a4a55e5
@ -175,7 +175,8 @@ namespace llvm {
|
||||
/// This method assumes the instruction returns a "nonlocal" dependency
|
||||
/// within its own block.
|
||||
void getNonLocalDependency(Instruction *QueryInst,
|
||||
DenseMap<BasicBlock*, MemDepResult> &Result);
|
||||
SmallVectorImpl<std::pair<BasicBlock*,
|
||||
MemDepResult> > &Result);
|
||||
|
||||
/// removeInstruction - Remove an instruction from the dependence analysis,
|
||||
/// updating the dependence of instructions that previously depended on it.
|
||||
|
@ -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
|
||||
|
@ -495,11 +495,11 @@ uint32_t ValueTable::lookup_or_add(Value* V) {
|
||||
}
|
||||
|
||||
|
||||
DenseMap<BasicBlock*, MemDepResult> deps;
|
||||
SmallVector<std::pair<BasicBlock*, MemDepResult>, 32> deps;
|
||||
MD->getNonLocalDependency(C, deps);
|
||||
CallInst* cdep = 0;
|
||||
|
||||
for (DenseMap<BasicBlock*, MemDepResult>
|
||||
for (SmallVector<std::pair<BasicBlock*, MemDepResult>, 32>
|
||||
::iterator I = deps.begin(), E = deps.end(); I != E; ++I) {
|
||||
if (I->second.isNone()) {
|
||||
valueNumbering.insert(std::make_pair(V, nextValueNumber));
|
||||
@ -871,7 +871,7 @@ bool GVN::processNonLocalLoad(LoadInst* L,
|
||||
MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>();
|
||||
|
||||
// Find the non-local dependencies of the load
|
||||
DenseMap<BasicBlock*, MemDepResult> deps;
|
||||
SmallVector<std::pair<BasicBlock*, MemDepResult>, 32> deps;
|
||||
MD.getNonLocalDependency(L, deps);
|
||||
|
||||
// If we had to process more than one hundred blocks to find the
|
||||
@ -885,8 +885,8 @@ bool GVN::processNonLocalLoad(LoadInst* L,
|
||||
DenseMap<BasicBlock*, Value*> repl;
|
||||
|
||||
// Filter out useless results (non-locals, etc)
|
||||
for (DenseMap<BasicBlock*, MemDepResult>::iterator I = deps.begin(),
|
||||
E = deps.end(); I != E; ++I) {
|
||||
for (SmallVector<std::pair<BasicBlock*, MemDepResult>, 32>::iterator
|
||||
I = deps.begin(), E = deps.end(); I != E; ++I) {
|
||||
if (I->second.isNone()) {
|
||||
repl[I->first] = UndefValue::get(L->getType());
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user