mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-11 13:44:28 +00:00
Make the non-local CSE safety checks slightly more thorough.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51035 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0e68771536
commit
16db1f70b7
@ -443,7 +443,7 @@ uint32_t ValueTable::lookup_or_add(Value* V) {
|
||||
|
||||
DenseMap<BasicBlock*, Value*> deps;
|
||||
MD->getNonLocalDependency(C, deps);
|
||||
Value* dep = 0;
|
||||
CallInst* cdep = 0;
|
||||
|
||||
for (DenseMap<BasicBlock*, Value*>::iterator I = deps.begin(),
|
||||
E = deps.end(); I != E; ++I) {
|
||||
@ -453,22 +453,24 @@ uint32_t ValueTable::lookup_or_add(Value* V) {
|
||||
return nextValueNumber++;
|
||||
} else if (I->second != MemoryDependenceAnalysis::NonLocal) {
|
||||
if (DT->dominates(I->first, C->getParent())) {
|
||||
dep = I->second;
|
||||
if (CallInst* CD = dyn_cast<CallInst>(I->second))
|
||||
cdep = CD;
|
||||
else {
|
||||
valueNumbering.insert(std::make_pair(V, nextValueNumber));
|
||||
return nextValueNumber++;
|
||||
}
|
||||
} else {
|
||||
valueNumbering.insert(std::make_pair(V, nextValueNumber));
|
||||
|
||||
return nextValueNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!dep || !isa<CallInst>(dep)) {
|
||||
if (!cdep) {
|
||||
valueNumbering.insert(std::make_pair(V, nextValueNumber));
|
||||
return nextValueNumber++;
|
||||
}
|
||||
|
||||
CallInst* cdep = cast<CallInst>(dep);
|
||||
|
||||
if (cdep->getCalledFunction() != C->getCalledFunction() ||
|
||||
cdep->getNumOperands() != C->getNumOperands()) {
|
||||
valueNumbering.insert(std::make_pair(V, nextValueNumber));
|
||||
|
Loading…
Reference in New Issue
Block a user