mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-08 13:00:50 +00:00
Don't perform an extra traversal of the function just to do cleanup. We can safely simplify instructions after each block has been processed without worrying about iterator invalidation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112594 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
da2ae63206
commit
7c37f6d2d9
@ -102,7 +102,7 @@ bool CorrelatedValuePropagation::runOnFunction(Function &F) {
|
||||
|
||||
bool Changed = false;
|
||||
|
||||
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI)
|
||||
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) {
|
||||
for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE; ) {
|
||||
Instruction *II = BI++;
|
||||
if (SelectInst *SI = dyn_cast<SelectInst>(II))
|
||||
@ -110,10 +110,9 @@ bool CorrelatedValuePropagation::runOnFunction(Function &F) {
|
||||
else if (PHINode *P = dyn_cast<PHINode>(II))
|
||||
Changed |= processPHI(P);
|
||||
}
|
||||
|
||||
if (Changed)
|
||||
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI)
|
||||
SimplifyInstructionsInBlock(FI);
|
||||
|
||||
SimplifyInstructionsInBlock(FI);
|
||||
}
|
||||
|
||||
return Changed;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user