summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/ConstantProp.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-05-10 15:38:35 +0000
committerChris Lattner <sabre@nondot.org>2002-05-10 15:38:35 +0000
commit0b18c1d64e690b5472c310c1293434e00bb26524 (patch)
tree35b861e74e78c958a184e7f1849cdfcd34f28041 /llvm/lib/Transforms/Scalar/ConstantProp.cpp
parentbad1b4dfcea66f1c52c88cb9f81f3a768bb00f1b (diff)
downloadbcm5719-llvm-0b18c1d64e690b5472c310c1293434e00bb26524.tar.gz
bcm5719-llvm-0b18c1d64e690b5472c310c1293434e00bb26524.zip
Add support for printing out statistics information when -stats is added to
the command line llvm-svn: 2601
Diffstat (limited to 'llvm/lib/Transforms/Scalar/ConstantProp.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/ConstantProp.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/ConstantProp.cpp b/llvm/lib/Transforms/Scalar/ConstantProp.cpp
index 7598afe32b3..013ddc0107c 100644
--- a/llvm/lib/Transforms/Scalar/ConstantProp.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstantProp.cpp
@@ -19,6 +19,9 @@
#include "llvm/Support/InstIterator.h"
#include <set>
+#include "Support/StatisticReporter.h"
+static Statistic<> NumInstKilled("constprop - Number of instructions killed");
+
namespace {
struct ConstantPropogation : public FunctionPass {
const char *getPassName() const { return "Simple Constant Propogation"; }
@@ -55,9 +58,10 @@ bool ConstantPropogation::runOnFunction(Function *F) {
// Replace all of the uses of a variable with uses of the constant.
I->replaceAllUsesWith(C);
-
+
// We made a change to the function...
Changed = true;
+ ++NumInstKilled;
}
}
return Changed;
OpenPOWER on IntegriCloud