[llvm-commits] [llvm] r152425 - /llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
Duncan Sands
baldrick at free.fr
Fri Mar 9 11:21:15 PST 2012
Author: baldrick
Date: Fri Mar 9 13:21:15 2012
New Revision: 152425
URL: http://llvm.org/viewvc/llvm-project?rev=152425&view=rev
Log:
Add statistics on removed switch cases, and fix the phi statistic
to count the number of phis changed, not the number visited.
Modified:
llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp?rev=152425&r1=152424&r2=152425&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp Fri Mar 9 13:21:15 2012
@@ -28,6 +28,7 @@
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 @@
Changed = true;
}
- ++NumPhis;
+ if (Changed)
+ ++NumPhis;
return Changed;
}
@@ -233,12 +235,14 @@
// 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;
}
More information about the llvm-commits
mailing list