aboutsummaryrefslogtreecommitdiffstats
path: root/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
commita8eb6bb408e84ceb468ceb409f4c87308e67b9eb (patch)
tree1a56fbfc23c417e2842326f46a40fe2b5a16f728 /lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
parent07c32218f448b7637d4acad8e87ce7cfaef0277e (diff)
downloadexternal_llvm-a8eb6bb408e84ceb468ceb409f4c87308e67b9eb.zip
external_llvm-a8eb6bb408e84ceb468ceb409f4c87308e67b9eb.tar.gz
external_llvm-a8eb6bb408e84ceb468ceb409f4c87308e67b9eb.tar.bz2
Add statistics on removed switch cases, and fix the phi statistic
to count the number of phis changed, not the number visited. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152425 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/CorrelatedValuePropagation.cpp')
-rw-r--r--lib/Transforms/Scalar/CorrelatedValuePropagation.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index ffe4991..3fd72a4 100644
--- a/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/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;
}