summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2012-03-09 19:21:15 +0000
committerDuncan Sands <baldrick@free.fr>2012-03-09 19:21:15 +0000
commit14eb17583698d1a7b7634c0740984fd9575063e7 (patch)
treea3b7cc1203721351b6bd5feded8835f19e32d729 /llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
parentf5a0d10c2c2a7fe89bdfcc0cf35923793998da9c (diff)
downloadbcm5719-llvm-14eb17583698d1a7b7634c0740984fd9575063e7.tar.gz
bcm5719-llvm-14eb17583698d1a7b7634c0740984fd9575063e7.zip
Add statistics on removed switch cases, and fix the phi statistic
to count the number of phis changed, not the number visited. llvm-svn: 152425
Diffstat (limited to 'llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index ffe499135eb..3fd72a4306c 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -28,6 +28,7 @@ STATISTIC(NumPhis, "Number of phis propagated");
STATISTIC(NumSelects, "Number of selects propagated");
STATISTIC(NumMemAccess, "Number of memory access targets propagated");
STATISTIC(NumCmps, "Number of comparisons propagated");
+STATISTIC(NumDeadCases, "Number of switch cases removed");
namespace {
class CorrelatedValuePropagation : public FunctionPass {
@@ -111,7 +112,8 @@ bool CorrelatedValuePropagation::processPHI(PHINode *P) {
Changed = true;
}
- ++NumPhis;
+ if (Changed)
+ ++NumPhis;
return Changed;
}
@@ -233,12 +235,14 @@ bool CorrelatedValuePropagation::processSwitch(SwitchInst *SI) {
// This case never fires - remove it.
CI.getCaseSuccessor()->removePredecessor(BB);
SI->removeCase(CI); // Does not invalidate the iterator.
+ ++NumDeadCases;
Changed = true;
} else if (State == LazyValueInfo::True) {
// This case always fires. Arrange for the switch to be turned into an
// unconditional branch by replacing the switch condition with the case
// value.
SI->setCondition(Case);
+ NumDeadCases += SI->getNumCases();
Changed = true;
break;
}
OpenPOWER on IntegriCloud