mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-28 06:27:16 +00:00
Only try to clean up the current block if we changed that block already.
llvm-svn: 112625
This commit is contained in:
parent
9cc0a6397a
commit
5e2c04e417
@ -100,19 +100,25 @@ bool CorrelatedValuePropagation::processPHI(PHINode *P) {
|
||||
bool CorrelatedValuePropagation::runOnFunction(Function &F) {
|
||||
LVI = &getAnalysis<LazyValueInfo>();
|
||||
|
||||
bool Changed = false;
|
||||
bool FnChanged = false;
|
||||
|
||||
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) {
|
||||
bool BBChanged = false;
|
||||
for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE; ) {
|
||||
Instruction *II = BI++;
|
||||
if (SelectInst *SI = dyn_cast<SelectInst>(II))
|
||||
Changed |= processSelect(SI);
|
||||
BBChanged |= processSelect(SI);
|
||||
else if (PHINode *P = dyn_cast<PHINode>(II))
|
||||
Changed |= processPHI(P);
|
||||
BBChanged |= processPHI(P);
|
||||
}
|
||||
|
||||
SimplifyInstructionsInBlock(FI);
|
||||
// Propagating correlated values might leave cruft around.
|
||||
// Try to clean it up before we continue.
|
||||
if (BBChanged)
|
||||
SimplifyInstructionsInBlock(FI);
|
||||
|
||||
FnChanged |= BBChanged;
|
||||
}
|
||||
|
||||
return Changed;
|
||||
return FnChanged;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user