aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/Reassociate.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
commit3dec1f272219ee1f8e1499929cdf53f5bc3c2272 (patch)
tree5f1b55fbf194e79beb850cf398cc39d13071c0d7 /lib/Transforms/Scalar/Reassociate.cpp
parent55547274bc3ef98165275da8b0f9af24c268dcf5 (diff)
downloadexternal_llvm-3dec1f272219ee1f8e1499929cdf53f5bc3c2272.tar.gz
external_llvm-3dec1f272219ee1f8e1499929cdf53f5bc3c2272.tar.bz2
external_llvm-3dec1f272219ee1f8e1499929cdf53f5bc3c2272.zip
Add support for printing out statistics information when -stats is added to
the command line git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2601 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/Reassociate.cpp')
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index cb7f47b988..02ccfee46a 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -25,6 +25,10 @@
#include "llvm/Constant.h"
#include "llvm/Support/CFG.h"
#include "Support/PostOrderIterator.h"
+#include "Support/StatisticReporter.h"
+
+static Statistic<> NumChanged("reassociate\t- Number of insts reassociated");
+static Statistic<> NumSwapped("reassociate\t- Number of insts with operands swapped");
namespace {
class Reassociate : public FunctionPass {
@@ -115,6 +119,7 @@ bool Reassociate::ReassociateExpr(BinaryOperator *I) {
std::swap(LHS, RHS);
std::swap(LHSRank, RHSRank);
Changed = true;
+ ++NumSwapped;
//cerr << "Transposed: " << I << " Result BB: " << I->getParent();
}
@@ -136,6 +141,7 @@ bool Reassociate::ReassociateExpr(BinaryOperator *I) {
LHSI->setOperand(TakeOp, RHS);
I->setOperand(1, LHSI);
+ ++NumChanged;
//cerr << "Reassociated: " << I << " Result BB: " << I->getParent();
// Since we modified the RHS instruction, make sure that we recheck it.