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/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp
index 79fed78..a716caa 100644
--- a/lib/Transforms/Scalar/GCSE.cpp
+++ b/lib/Transforms/Scalar/GCSE.cpp
@@ -20,8 +20,11 @@
 #include "llvm/Analysis/Dominators.h"
 #include "llvm/Support/InstVisitor.h"
 #include "llvm/Support/InstIterator.h"
+#include "Support/StatisticReporter.h"
 #include <algorithm>
 
+static Statistic<> NumInstRemoved("gcse\t\t- Number of instructions removed");
+
 namespace {
   class GCSE : public FunctionPass, public InstVisitor<GCSE, bool> {
     set<Instruction*> WorkList;
@@ -131,6 +134,8 @@
 
   WorkList.erase(Other); // Other may not actually be on the worklist anymore...
 
+  ++NumInstRemoved;   // Keep track of number of instructions eliminated
+
   // Handle the easy case, where both instructions are in the same basic block
   BasicBlock *BB1 = I->getParent(), *BB2 = Other->getParent();
   if (BB1 == BB2) {