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
diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
index a973899..90301f8 100644
--- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
+++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
@@ -15,6 +15,9 @@
#include "llvm/iOther.h"
#include "llvm/BasicBlock.h"
#include "llvm/Pass.h"
+#include "Support/StatisticReporter.h"
+
+static Statistic<> NumAdded("lowerrefs\t\t- New instructions added");
namespace {
struct DecomposePass : public BasicBlockPass {
@@ -112,6 +115,7 @@
if (!indexIsZero) {
LastPtr = new GetElementPtrInst(LastPtr, Indices, "ptr1");
NewInsts.push_back(cast<Instruction>(LastPtr));
+ ++NumAdded;
}
// Instruction 2: nextPtr2 = cast nextPtr1 to NextPtrTy
@@ -120,6 +124,7 @@
if (LastPtr->getType() != NextPtrTy) {
LastPtr = new CastInst(LastPtr, NextPtrTy, "ptr2");
NewInsts.push_back(cast<Instruction>(LastPtr));
+ ++NumAdded;
}
}