From 0b18c1d64e690b5472c310c1293434e00bb26524 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 10 May 2002 15:38:35 +0000 Subject: [PATCH] Add support for printing out statistics information when -stats is added to the command line llvm-svn: 2601 --- llvm/lib/Transforms/IPO/ConstantMerge.cpp | 4 ++++ .../Transforms/IPO/DeadTypeElimination.cpp | 16 +++++++++++++ llvm/lib/Transforms/IPO/GlobalDCE.cpp | 5 ++++ llvm/lib/Transforms/IPO/InlineSimple.cpp | 4 ++++ llvm/lib/Transforms/IPO/Internalize.cpp | 12 +++++++--- llvm/lib/Transforms/IPO/RaiseAllocations.cpp | 5 ++++ llvm/lib/Transforms/Scalar/ConstantProp.cpp | 6 ++++- llvm/lib/Transforms/Scalar/DCE.cpp | 10 ++++++-- .../Scalar/DecomposeMultiDimRefs.cpp | 5 ++++ llvm/lib/Transforms/Scalar/GCSE.cpp | 5 ++++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 24 +++++++++++-------- .../Scalar/InstructionCombining.cpp | 3 +++ .../Transforms/Scalar/LowerAllocations.cpp | 7 +++++- .../lib/Transforms/Scalar/PiNodeInsertion.cpp | 5 ++++ llvm/lib/Transforms/Scalar/Reassociate.cpp | 6 +++++ llvm/lib/Transforms/Scalar/SCCP.cpp | 4 ++++ .../Utils/PromoteMemoryToRegister.cpp | 5 ++++ 17 files changed, 109 insertions(+), 17 deletions(-) diff --git a/llvm/lib/Transforms/IPO/ConstantMerge.cpp b/llvm/lib/Transforms/IPO/ConstantMerge.cpp index 146911e818dd..11191f535ab6 100644 --- a/llvm/lib/Transforms/IPO/ConstantMerge.cpp +++ b/llvm/lib/Transforms/IPO/ConstantMerge.cpp @@ -19,6 +19,9 @@ #include "llvm/Module.h" #include "llvm/Function.h" #include "llvm/Pass.h" +#include "Support/StatisticReporter.h" + +static Statistic<> NumMerged("constmerge\t\t- Number of global constants merged"); // mergeDuplicateConstants - Workhorse for the pass. This eliminates duplicate // constants, starting at global ConstantNo, and adds vars to the map if they @@ -50,6 +53,7 @@ bool mergeDuplicateConstants(Module *M, unsigned &ConstantNo, delete GList.remove(GList.begin()+ConstantNo); --ConstantNo; // Don't skip the next constant. + ++NumMerged; MadeChanges = true; } } diff --git a/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp b/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp index 99c092263bb4..97cb30cc6d0d 100644 --- a/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadTypeElimination.cpp @@ -27,6 +27,13 @@ #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include #include +#include "Support/StatisticReporter.h" + +static Statistic<> NumResolved("funcresolve\t- Number of varargs functions resolved"); +static Statistic<> NumTypeSymtabEntriesKilled("cleangcc\t- Number of unused typenames removed from symtab"); +static Statistic<> NumCastsMoved("cleangcc\t- Number of casts removed from head of basic block"); +static Statistic<> NumRefactoredPreds("cleangcc\t- Number of predecessor blocks refactored"); + using std::vector; using std::string; using std::cerr; @@ -112,6 +119,7 @@ bool CleanupGCCOutput::doInitialization(Module *M) { Plane.erase(PI); // Alas, GCC 2.95.3 doesn't *SIGH* PI = Plane.begin(); #endif + ++NumTypeSymtabEntriesKilled; Changed = true; } else { ++PI; @@ -159,6 +167,9 @@ static inline bool FixCastsAndPHIs(BasicBlock *BB) { // Move the cast instruction to the current insert position... --InsertPos; // New position for cast to go... std::swap(*InsertPos, *I); // Cast goes down, PHI goes up + Changed = true; + + ++NumCastsMoved; if (isa(Src) && // Handle case #1 cast(Src)->getParent() == BB) { @@ -196,6 +207,7 @@ static inline bool FixCastsAndPHIs(BasicBlock *BB) { // Reinsert the cast right before the terminator in Pred. Pred->getInstList().insert(Pred->end()-1, CI); + Changed = true; } } else { ++I; @@ -281,6 +293,7 @@ bool CleanupGCCOutput::runOnFunction(Function *M) { for (unsigned i = 0; i < Preds.size(); ++i) { if (SortedPreds[i] == LastOne) { // Found a duplicate. RefactorPredecessor(BB, SortedPreds[i]); + ++NumRefactoredPreds; Changed = true; } LastOne = SortedPreds[i]; @@ -430,6 +443,7 @@ bool FunctionResolvingPass::run(Module *M) { delete Functions[i]; Functions.erase(Functions.begin()+i); Changed = true; + ++NumResolved; continue; } } @@ -499,11 +513,13 @@ bool FunctionResolvingPass::run(Module *M) { assert(CI->getOperand(0) == Old); CI->setOperand(0, Concrete); Changed = true; + ++NumResolved; } else if (CallInst *CI = dyn_cast(U)) { // Can only fix up calls TO the argument, not args passed in. if (CI->getCalledValue() == Old) { ConvertCallTo(CI, Concrete); Changed = true; + ++NumResolved; } else { cerr << "Couldn't cleanup this function call, must be an" << " argument or something!" << CI; diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp index a0614e2bf313..8da9f0481e3f 100644 --- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp +++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp @@ -11,6 +11,9 @@ #include "llvm/GlobalVariable.h" #include "llvm/Analysis/CallGraph.h" #include "Support/DepthFirstIterator.h" +#include "Support/StatisticReporter.h" + +static Statistic<> NumRemoved("globaldce\t- Number of global values removed"); static bool RemoveUnreachableFunctions(Module *M, CallGraph &CallGraph) { // Calculate which functions are reachable from the external functions in the @@ -30,6 +33,7 @@ static bool RemoveUnreachableFunctions(Module *M, CallGraph &CallGraph) { (*I)->dropAllReferences(); N->removeAllCalledMethods(); FunctionsToDelete.push_back(N); + ++NumRemoved; } } @@ -57,6 +61,7 @@ static bool RemoveUnreachableGlobalVariables(Module *M) { ++I; // Cannot eliminate global variable else { delete M->getGlobalList().remove(I); + ++NumRemoved; Changed = true; } return Changed; diff --git a/llvm/lib/Transforms/IPO/InlineSimple.cpp b/llvm/lib/Transforms/IPO/InlineSimple.cpp index 9e84138b08e3..12430e12702f 100644 --- a/llvm/lib/Transforms/IPO/InlineSimple.cpp +++ b/llvm/lib/Transforms/IPO/InlineSimple.cpp @@ -27,6 +27,9 @@ #include "llvm/iOther.h" #include "llvm/Type.h" #include "llvm/Argument.h" +#include "Support/StatisticReporter.h" + +static Statistic<> NumInlined("inline\t\t- Number of functions inlined"); #include #include using std::cerr; @@ -258,6 +261,7 @@ static bool doFunctionInlining(Function *F) { // Loop through now and inline instructions a basic block at a time... for (Function::iterator I = F->begin(); I != F->end(); ) if (DoFunctionInlining(*I)) { + ++NumInlined; Changed = true; // Iterator is now invalidated by new basic blocks inserted I = F->begin(); diff --git a/llvm/lib/Transforms/IPO/Internalize.cpp b/llvm/lib/Transforms/IPO/Internalize.cpp index c84be9b93a29..279c7eb887a9 100644 --- a/llvm/lib/Transforms/IPO/Internalize.cpp +++ b/llvm/lib/Transforms/IPO/Internalize.cpp @@ -10,6 +10,9 @@ #include "llvm/Pass.h" #include "llvm/Module.h" #include "llvm/Function.h" +#include "Support/StatisticReporter.h" + +static Statistic<> NumChanged("internalize\t- Number of functions internal'd"); class InternalizePass : public Pass { const char *getPassName() const { return "Internalize Functions"; } @@ -28,9 +31,12 @@ class InternalizePass : public Pass { // Found a main function, mark all functions not named main as internal. for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) - if ((*I)->getName() != "main" && // Leave the main function external - !(*I)->isExternal()) // Function must be defined here - (*I)->setInternalLinkage(Changed = true); + if ((*I)->getName() != "main" && // Leave the main function external + !(*I)->isExternal()) { // Function must be defined here + (*I)->setInternalLinkage(true); + Changed = true; + ++NumChanged; + } return Changed; } diff --git a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp index d5730985e8ae..9b56f6a84d18 100644 --- a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp @@ -13,6 +13,9 @@ #include "llvm/iMemory.h" #include "llvm/iOther.h" #include "llvm/Pass.h" +#include "Support/StatisticReporter.h" + +static Statistic<> NumRaised("raiseallocs\t- Number of allocations raised"); namespace { @@ -91,11 +94,13 @@ bool RaiseAllocations::runOnBasicBlock(BasicBlock *BB) { CI->setName(""); ReplaceInstWithInst(BIL, BI, MallocI); Changed = true; + ++NumRaised; continue; // Skip the ++BI } else if (CI->getCalledValue() == FreeFunc) { // Replace call to free? ReplaceInstWithInst(BIL, BI, new FreeInst(CI->getOperand(1))); Changed = true; continue; // Skip the ++BI + ++NumRaised; } } diff --git a/llvm/lib/Transforms/Scalar/ConstantProp.cpp b/llvm/lib/Transforms/Scalar/ConstantProp.cpp index 7598afe32b31..013ddc0107c7 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 +#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; diff --git a/llvm/lib/Transforms/Scalar/DCE.cpp b/llvm/lib/Transforms/Scalar/DCE.cpp index 793b3abb6a3a..2c9c8b3b0d5f 100644 --- a/llvm/lib/Transforms/Scalar/DCE.cpp +++ b/llvm/lib/Transforms/Scalar/DCE.cpp @@ -14,8 +14,12 @@ #include "llvm/Instruction.h" #include "llvm/Pass.h" #include "llvm/Support/InstIterator.h" +#include "Support/StatisticReporter.h" #include +static Statistic<> DIEEliminated("die\t\t- Number of insts removed"); +static Statistic<> DCEEliminated("dce\t\t- Number of insts removed"); + //===----------------------------------------------------------------------===// // DeadInstElimination pass implementation // @@ -28,9 +32,10 @@ namespace { BasicBlock::InstListType &Vals = BB->getInstList(); bool Changed = false; for (BasicBlock::iterator DI = Vals.begin(); DI != Vals.end(); ) - if (dceInstruction(Vals, DI)) + if (dceInstruction(Vals, DI)) { Changed = true; - else + ++DIEEliminated; + } else ++DI; return Changed; } @@ -103,6 +108,7 @@ bool DCE::runOnFunction(Function *F) { for (BasicBlock::iterator BI = BBIL.begin(); BI != BBIL.end(); ) if (DeadInsts.count(*BI)) { // Is this instruction dead? delete BBIL.remove(BI); // Yup, remove and delete inst + ++DCEEliminated; } else { // This instruction is not dead ++BI; // Continue on to the next one... } diff --git a/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp index a97389999e64..90301f8792c9 100644 --- a/llvm/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp +++ b/llvm/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 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { if (!indexIsZero) { LastPtr = new GetElementPtrInst(LastPtr, Indices, "ptr1"); NewInsts.push_back(cast(LastPtr)); + ++NumAdded; } // Instruction 2: nextPtr2 = cast nextPtr1 to NextPtrTy @@ -120,6 +124,7 @@ void DecomposePass::decomposeArrayRef(BasicBlock::iterator &BBI) { if (LastPtr->getType() != NextPtrTy) { LastPtr = new CastInst(LastPtr, NextPtrTy, "ptr2"); NewInsts.push_back(cast(LastPtr)); + ++NumAdded; } } diff --git a/llvm/lib/Transforms/Scalar/GCSE.cpp b/llvm/lib/Transforms/Scalar/GCSE.cpp index 79fed781f93a..a716caa4a068 100644 --- a/llvm/lib/Transforms/Scalar/GCSE.cpp +++ b/llvm/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 +static Statistic<> NumInstRemoved("gcse\t\t- Number of instructions removed"); + namespace { class GCSE : public FunctionPass, public InstVisitor { set WorkList; @@ -131,6 +134,8 @@ void GCSE::CommonSubExpressionFound(Instruction *I, Instruction *Other) { 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) { diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 5d2cd87725b8..7b1eb5d73275 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -14,6 +14,10 @@ #include "llvm/Constants.h" #include "llvm/Support/CFG.h" #include "Support/STLExtras.h" +#include "Support/StatisticReporter.h" + +static Statistic<> NumRemoved ("indvars\t\t- Number of aux indvars removed"); +static Statistic<> NumInserted("indvars\t\t- Number of cannonical indvars added"); #if 0 #define DEBUG @@ -38,7 +42,8 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { std::bind1st(std::ptr_fun(TransformLoop), Loops)); // Get the header node for this loop. All of the phi nodes that could be // induction variables must live in this basic block. - BasicBlock *Header = (BasicBlock*)Loop->getBlocks().front(); + // + BasicBlock *Header = Loop->getBlocks().front(); // Loop over all of the PHI nodes in the basic block, calculating the // induction variables that they represent... stuffing the induction variable @@ -107,6 +112,7 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { assert(IndVars.back().InductionType == InductionVariable::Cannonical && "Just inserted cannonical indvar that is not cannonical!"); Cannonical = &IndVars.back(); + ++NumInserted; Changed = true; } @@ -179,20 +185,13 @@ static bool TransformLoop(LoopInfo *Loops, Loop *Loop) { delete IV->Phi; InsertPos--; // Deleted an instr, decrement insert position Changed = true; + ++NumRemoved; } } return Changed; } -static bool doit(Function *M, LoopInfo &Loops) { - // Induction Variables live in the header nodes of the loops of the function - return reduce_apply_bool(Loops.getTopLevelLoops().begin(), - Loops.getTopLevelLoops().end(), - std::bind1st(std::ptr_fun(TransformLoop), &Loops)); -} - - namespace { struct InductionVariableSimplify : public FunctionPass { const char *getPassName() const { @@ -200,7 +199,12 @@ namespace { } virtual bool runOnFunction(Function *F) { - return doit(F, getAnalysis()); + LoopInfo &LI = getAnalysis(); + + // Induction Variables live in the header nodes of loops + return reduce_apply_bool(LI.getTopLevelLoops().begin(), + LI.getTopLevelLoops().end(), + std::bind1st(std::ptr_fun(TransformLoop), &LI)); } virtual void getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 385c07004d4e..0f676426e1ba 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -25,7 +25,9 @@ #include "llvm/Pass.h" #include "llvm/Support/InstIterator.h" #include "llvm/Support/InstVisitor.h" +#include "Support/StatisticReporter.h" +static Statistic<> NumCombined("instcombine\t- Number of insts combined"); namespace { class InstCombiner : public FunctionPass, @@ -547,6 +549,7 @@ bool InstCombiner::runOnFunction(Function *F) { // Now that we have an instruction, try combining it to simplify it... Instruction *Result = visit(I); if (Result) { + ++NumCombined; // Should we replace the old instruction with a new one? if (Result != I) ReplaceInstWithInst(I, Result); diff --git a/llvm/lib/Transforms/Scalar/LowerAllocations.cpp b/llvm/lib/Transforms/Scalar/LowerAllocations.cpp index e5bf88fc00ca..80eab61b7587 100644 --- a/llvm/lib/Transforms/Scalar/LowerAllocations.cpp +++ b/llvm/lib/Transforms/Scalar/LowerAllocations.cpp @@ -15,6 +15,9 @@ #include "llvm/Constants.h" #include "llvm/Pass.h" #include "llvm/Target/TargetData.h" +#include "Support/StatisticReporter.h" + +static Statistic<> NumLowered("lowerallocs\t- Number of allocations lowered"); using std::vector; namespace { @@ -81,7 +84,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock *BB) { assert(MallocFunc && FreeFunc && BB && "Pass not initialized!"); // Loop over all of the instructions, looking for malloc or free instructions - for (unsigned i = 0; i < BB->size(); ++i) { + for (unsigned i = 0; i != BB->size(); ++i) { BasicBlock::InstListType &BBIL = BB->getInstList(); if (MallocInst *MI = dyn_cast(*(BBIL.begin()+i))) { BBIL.remove(BBIL.begin()+i); // remove the malloc instr... @@ -116,6 +119,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock *BB) { MI->replaceAllUsesWith(MCast); delete MI; // Delete the malloc inst Changed = true; + ++NumLowered; } else if (FreeInst *FI = dyn_cast(*(BBIL.begin()+i))) { BBIL.remove(BB->getInstList().begin()+i); @@ -132,6 +136,7 @@ bool LowerAllocations::runOnBasicBlock(BasicBlock *BB) { // Delete the old free instruction delete FI; Changed = true; + ++NumLowered; } } diff --git a/llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp b/llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp index d7bc08b1a4b3..2e9c32800b61 100644 --- a/llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp +++ b/llvm/lib/Transforms/Scalar/PiNodeInsertion.cpp @@ -34,6 +34,9 @@ #include "llvm/iOperators.h" #include "llvm/iPHINode.h" #include "llvm/Support/CFG.h" +#include "Support/StatisticReporter.h" + +static Statistic<> NumInserted("pinodes\t\t- Number of Pi nodes inserted"); namespace { struct PiNodeInserter : public FunctionPass { @@ -180,6 +183,8 @@ bool PiNodeInserter::insertPiNodeFor(Value *V, BasicBlock *Succ, Value *Rep) { if (Rep == 0) cast(Pi)->addIncoming(V, Pred); + + ++NumInserted; return true; } diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp index cb7f47b9884f..02ccfee46a95 100644 --- a/llvm/lib/Transforms/Scalar/Reassociate.cpp +++ b/llvm/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. diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index b936c6f2c89c..05945458cb6d 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp @@ -26,11 +26,14 @@ #include "llvm/Pass.h" #include "llvm/Support/InstVisitor.h" #include "Support/STLExtras.h" +#include "Support/StatisticReporter.h" #include #include #include using std::cerr; +static Statistic<> NumInstRemoved("sccp\t\t- Number of instructions removed"); + #if 0 // Enable this to get SCCP debug output #define DEBUG_SCCP(X) X #else @@ -315,6 +318,7 @@ bool SCCP::runOnFunction(Function *F) { // Hey, we just changed something! MadeChanges = true; + ++NumInstRemoved; } else { ++BI; } diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index f67e6d671fa9..1afb11a986f8 100644 --- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -26,6 +26,9 @@ #include "llvm/BasicBlock.h" #include "llvm/Constant.h" #include "llvm/Type.h" +#include "Support/StatisticReporter.h" + +static Statistic<> NumPromoted("mem2reg\t\t- Number of alloca's promoted"); using std::vector; using std::map; @@ -187,6 +190,8 @@ bool PromotePass::runOnFunction(Function *F) { delete I; } + NumPromoted += Allocas.size(); + // Purge data structurse so they are available the next iteration... Allocas.clear(); AllocaLookup.clear();