summaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-08-31 18:55:52 +0000
committerOwen Anderson <resistor@mac.com>2010-08-31 18:55:52 +0000
commit869a144f4e53db38789e630fbd9cc57384685ce6 (patch)
treed6f5523ce0bda7f781ff0e00af3139573209a1ab /lib/Transforms
parentc1dc78de762e8a65fe1edd0cced13d94ab5a971f (diff)
downloadexternal_llvm-869a144f4e53db38789e630fbd9cc57384685ce6.zip
external_llvm-869a144f4e53db38789e630fbd9cc57384685ce6.tar.gz
external_llvm-869a144f4e53db38789e630fbd9cc57384685ce6.tar.bz2
Only try to clean up the current block if we changed that block already.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112625 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/CorrelatedValuePropagation.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index a62eb20..c673b0b 100644
--- a/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -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;
}