diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index 536b61f1080..825c7815362 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -13,6 +13,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "adce" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" @@ -29,11 +30,11 @@ #include using namespace llvm; -namespace { - Statistic NumBlockRemoved("adce", "Number of basic blocks removed"); - Statistic NumInstRemoved ("adce", "Number of instructions removed"); - Statistic NumCallRemoved ("adce", "Number of calls and invokes removed"); +STATISTIC(NumBlockRemoved, "Number of basic blocks removed"); +STATISTIC(NumInstRemoved , "Number of instructions removed"); +STATISTIC(NumCallRemoved , "Number of calls and invokes removed"); +namespace { //===----------------------------------------------------------------------===// // ADCE Class // diff --git a/lib/Transforms/Scalar/BasicBlockPlacement.cpp b/lib/Transforms/Scalar/BasicBlockPlacement.cpp index 135d6b31d37..020b2b2c52e 100644 --- a/lib/Transforms/Scalar/BasicBlockPlacement.cpp +++ b/lib/Transforms/Scalar/BasicBlockPlacement.cpp @@ -26,6 +26,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "block-placement" #include "llvm/Analysis/ProfileInfo.h" #include "llvm/Function.h" #include "llvm/Pass.h" @@ -35,9 +36,9 @@ #include using namespace llvm; -namespace { - Statistic NumMoved("block-placement", "Number of basic blocks moved"); +STATISTIC(NumMoved, "Number of basic blocks moved"); +namespace { struct BlockPlacement : public FunctionPass { virtual bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/CondPropagate.cpp b/lib/Transforms/Scalar/CondPropagate.cpp index 4e076145f76..49a849625b3 100644 --- a/lib/Transforms/Scalar/CondPropagate.cpp +++ b/lib/Transforms/Scalar/CondPropagate.cpp @@ -25,12 +25,10 @@ #include "llvm/Support/Streams.h" using namespace llvm; -namespace { - Statistic - NumBrThread("condprop", "Number of CFG edges threaded through branches"); - Statistic - NumSwThread("condprop", "Number of CFG edges threaded through switches"); +STATISTIC(NumBrThread, "Number of CFG edges threaded through branches"); +STATISTIC(NumSwThread, "Number of CFG edges threaded through switches"); +namespace { struct CondProp : public FunctionPass { virtual bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp index 54ccccce7c1..d888a10c727 100644 --- a/lib/Transforms/Scalar/ConstantProp.cpp +++ b/lib/Transforms/Scalar/ConstantProp.cpp @@ -18,6 +18,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "constprop" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Constant.h" @@ -28,9 +29,9 @@ #include using namespace llvm; -namespace { - Statistic NumInstKilled("constprop", "Number of instructions killed"); +STATISTIC(NumInstKilled, "Number of instructions killed"); +namespace { struct ConstantPropagation : public FunctionPass { bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp index a796ff742eb..7ab999f9638 100644 --- a/lib/Transforms/Scalar/CorrelatedExprs.cpp +++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp @@ -26,6 +26,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "cee" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/Pass.h" @@ -44,11 +45,11 @@ #include using namespace llvm; -namespace { - Statistic NumSetCCRemoved("cee", "Number of setcc instruction eliminated"); - Statistic NumOperandsCann("cee", "Number of operands canonicalized"); - Statistic BranchRevectors("cee", "Number of branches revectored"); +STATISTIC(NumSetCCRemoved, "Number of setcc instruction eliminated"); +STATISTIC(NumOperandsCann, "Number of operands canonicalized"); +STATISTIC(BranchRevectors, "Number of branches revectored"); +namespace { class ValueInfo; class Relation { Value *Val; // Relation to what value? diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index 3304527d1eb..cf1a7fc877d 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/lib/Transforms/Scalar/DCE.cpp @@ -16,6 +16,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "dce" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Instruction.h" @@ -25,14 +26,13 @@ #include using namespace llvm; -namespace { - Statistic DIEEliminated("die", "Number of insts removed"); - Statistic DCEEliminated("dce", "Number of insts removed"); +STATISTIC(DIEEliminated, "Number of insts removed by DIE pass"); +STATISTIC(DCEEliminated, "Number of insts removed"); +namespace { //===--------------------------------------------------------------------===// // DeadInstElimination pass implementation // - struct DeadInstElimination : public BasicBlockPass { virtual bool runOnBasicBlock(BasicBlock &BB) { bool Changed = false; @@ -58,11 +58,10 @@ FunctionPass *llvm::createDeadInstEliminationPass() { } -//===----------------------------------------------------------------------===// -// DeadCodeElimination pass implementation -// - namespace { + //===--------------------------------------------------------------------===// + // DeadCodeElimination pass implementation + // struct DCE : public FunctionPass { virtual bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index 8057ebdc727..39f2506c163 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -15,6 +15,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "dse" #include "llvm/Transforms/Scalar.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" @@ -27,10 +28,10 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumStores("dse", "Number of stores deleted"); - Statistic NumOther ("dse", "Number of other instrs removed"); +STATISTIC(NumStores, "Number of stores deleted"); +STATISTIC(NumOther , "Number of other instrs removed"); +namespace { struct DSE : public FunctionPass { virtual bool runOnFunction(Function &F) { diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index a6d57ce26b8..80b9ae73a2b 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/lib/Transforms/Scalar/GCSE.cpp @@ -14,6 +14,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "gcse" #include "llvm/Transforms/Scalar.h" #include "llvm/BasicBlock.h" #include "llvm/Constant.h" @@ -27,15 +28,14 @@ #include using namespace llvm; +STATISTIC(NumInstRemoved, "Number of instructions removed"); +STATISTIC(NumLoadRemoved, "Number of loads removed"); +STATISTIC(NumCallRemoved, "Number of calls removed"); +STATISTIC(NumNonInsts , "Number of instructions removed due " + "to non-instruction values"); +STATISTIC(NumArgsRepl , "Number of function arguments replaced " + "with constant values"); namespace { - Statistic NumInstRemoved("gcse", "Number of instructions removed"); - Statistic NumLoadRemoved("gcse", "Number of loads removed"); - Statistic NumCallRemoved("gcse", "Number of calls removed"); - Statistic NumNonInsts ("gcse", "Number of instructions removed due " - "to non-instruction values"); - Statistic NumArgsRepl ("gcse", "Number of function arguments replaced " - "with constant values"); - struct GCSE : public FunctionPass { virtual bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index e17faa1d37c..91759dc9b58 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -37,6 +37,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "indvars" #include "llvm/Transforms/Scalar.h" #include "llvm/BasicBlock.h" #include "llvm/Constants.h" @@ -51,13 +52,13 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumRemoved ("indvars", "Number of aux indvars removed"); - Statistic NumPointer ("indvars", "Number of pointer indvars promoted"); - Statistic NumInserted("indvars", "Number of canonical indvars added"); - Statistic NumReplaced("indvars", "Number of exit values replaced"); - Statistic NumLFTR ("indvars", "Number of loop exit tests replaced"); +STATISTIC(NumRemoved , "Number of aux indvars removed"); +STATISTIC(NumPointer , "Number of pointer indvars promoted"); +STATISTIC(NumInserted, "Number of canonical indvars added"); +STATISTIC(NumReplaced, "Number of exit values replaced"); +STATISTIC(NumLFTR , "Number of loop exit tests replaced"); +namespace { class IndVarSimplify : public FunctionPass { LoopInfo *LI; ScalarEvolution *SE; diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 66c57a9bac8..8b6f3703b05 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -55,13 +55,13 @@ using namespace llvm; using namespace llvm::PatternMatch; -namespace { - Statistic NumCombined ("instcombine", "Number of insts combined"); - Statistic NumConstProp("instcombine", "Number of constant folds"); - Statistic NumDeadInst ("instcombine", "Number of dead inst eliminated"); - Statistic NumDeadStore("instcombine", "Number of dead stores eliminated"); - Statistic NumSunkInst ("instcombine", "Number of instructions sunk"); +STATISTIC(NumCombined , "Number of insts combined"); +STATISTIC(NumConstProp, "Number of constant folds"); +STATISTIC(NumDeadInst , "Number of dead inst eliminated"); +STATISTIC(NumDeadStore, "Number of dead stores eliminated"); +STATISTIC(NumSunkInst , "Number of instructions sunk"); +namespace { class VISIBILITY_HIDDEN InstCombiner : public FunctionPass, public InstVisitor { diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 4783388f3dc..40f341cdb4d 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -49,18 +49,17 @@ #include using namespace llvm; +STATISTIC(NumSunk , "Number of instructions sunk out of loop"); +STATISTIC(NumHoisted , "Number of instructions hoisted out of loop"); +STATISTIC(NumMovedLoads, "Number of load insts hoisted or sunk"); +STATISTIC(NumMovedCalls, "Number of call insts hoisted or sunk"); +STATISTIC(NumPromoted , "Number of memory locations promoted to registers"); + namespace { cl::opt DisablePromotion("disable-licm-promotion", cl::Hidden, cl::desc("Disable memory promotion in LICM pass")); - Statistic NumSunk("licm", "Number of instructions sunk out of loop"); - Statistic NumHoisted("licm", "Number of instructions hoisted out of loop"); - Statistic NumMovedLoads("licm", "Number of load insts hoisted or sunk"); - Statistic NumMovedCalls("licm", "Number of call insts hoisted or sunk"); - Statistic NumPromoted("licm", - "Number of memory locations promoted to registers"); - struct LICM : public FunctionPass { virtual bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 9426aa1a69d..eb58b9e052c 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -37,11 +37,11 @@ #include using namespace llvm; -namespace { - Statistic NumReduced ("loop-reduce", "Number of GEPs strength reduced"); - Statistic NumInserted("loop-reduce", "Number of PHIs inserted"); - Statistic NumVariable("loop-reduce","Number of PHIs with variable strides"); +STATISTIC(NumReduced , "Number of GEPs strength reduced"); +STATISTIC(NumInserted, "Number of PHIs inserted"); +STATISTIC(NumVariable, "Number of PHIs with variable strides"); +namespace { /// IVStrideUse - Keep track of one use of a strided induction variable, where /// the stride is stored externally. The Offset member keeps track of the /// offset from the IV, User is the actual user of the operand, and 'Operand' diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp index 45a48994174..603ba6adbb5 100644 --- a/lib/Transforms/Scalar/LoopUnroll.cpp +++ b/lib/Transforms/Scalar/LoopUnroll.cpp @@ -36,9 +36,9 @@ #include using namespace llvm; -namespace { - Statistic NumUnrolled("loop-unroll", "Number of loops completely unrolled"); +STATISTIC(NumUnrolled, "Number of loops completely unrolled"); +namespace { cl::opt UnrollThreshold("unroll-threshold", cl::init(100), cl::Hidden, cl::desc("The cut-off point for loop unrolling")); diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 3079ce92b55..e1d4a33e71e 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -43,14 +43,13 @@ #include using namespace llvm; +STATISTIC(NumBranches, "Number of branches unswitched"); +STATISTIC(NumSwitches, "Number of switches unswitched"); +STATISTIC(NumSelects , "Number of selects unswitched"); +STATISTIC(NumTrivial , "Number of unswitches that are trivial"); +STATISTIC(NumSimplify, "Number of simplifications of unswitched code"); + namespace { - Statistic NumBranches("loop-unswitch", "Number of branches unswitched"); - Statistic NumSwitches("loop-unswitch", "Number of switches unswitched"); - Statistic NumSelects ("loop-unswitch", "Number of selects unswitched"); - Statistic NumTrivial ("loop-unswitch", - "Number of unswitches that are trivial"); - Statistic NumSimplify("loop-unswitch", - "Number of simplifications of unswitched code"); cl::opt Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"), cl::init(10), cl::Hidden); diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index 196cd3854a0..69805f86bae 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -35,13 +35,12 @@ #include using namespace llvm; -namespace { - Statistic NumLinear ("reassociate","Number of insts linearized"); - Statistic NumChanged("reassociate","Number of insts reassociated"); - Statistic NumSwapped("reassociate","Number of insts with operands swapped"); - Statistic NumAnnihil("reassociate","Number of expr tree annihilated"); - Statistic NumFactor ("reassociate","Number of multiplies factored"); +STATISTIC(NumLinear , "Number of insts linearized"); +STATISTIC(NumChanged, "Number of insts reassociated"); +STATISTIC(NumAnnihil, "Number of expr tree annihilated"); +STATISTIC(NumFactor , "Number of multiplies factored"); +namespace { struct ValueEntry { unsigned Rank; Value *Op; diff --git a/lib/Transforms/Scalar/Reg2Mem.cpp b/lib/Transforms/Scalar/Reg2Mem.cpp index d43e5b33abc..ee4a228dd1b 100644 --- a/lib/Transforms/Scalar/Reg2Mem.cpp +++ b/lib/Transforms/Scalar/Reg2Mem.cpp @@ -16,6 +16,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "reg2mem" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Pass.h" @@ -24,14 +25,12 @@ #include "llvm/BasicBlock.h" #include "llvm/Instructions.h" #include "llvm/ADT/Statistic.h" - #include - using namespace llvm; +STATISTIC(NumDemoted, "Number of registers demoted"); + namespace { - Statistic NumDemoted("reg2mem", "Number of registers demoted"); - struct RegToMem : public FunctionPass { virtual void getAnalysisUsage(AnalysisUsage &AU) const { diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 4f0607ef294..aa7c7833cfa 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -39,6 +39,16 @@ #include using namespace llvm; +STATISTIC(NumInstRemoved, "Number of instructions removed"); +STATISTIC(NumDeadBlocks , "Number of basic blocks unreachable"); + +STATISTIC(IPNumInstRemoved, "Number ofinstructions removed by IPSCCP"); +STATISTIC(IPNumDeadBlocks , "Number of basic blocks unreachable by IPSCCP"); +STATISTIC(IPNumArgsElimed ,"Number of arguments constant propagated by IPSCCP"); +STATISTIC(IPNumGlobalConst, "Number of globals found to be constant by IPSCCP"); + + + // LatticeVal class - This class represents the different lattice values that an // instruction may occupy. It is a simple class with value semantics. // @@ -1081,9 +1091,6 @@ bool SCCPSolver::ResolveBranchesIn(Function &F) { namespace { - Statistic NumInstRemoved("sccp", "Number of instructions removed"); - Statistic NumDeadBlocks ("sccp", "Number of basic blocks unreachable"); - //===--------------------------------------------------------------------===// // /// SCCP Class - This class uses the SCCPSolver to implement a per-function @@ -1192,13 +1199,6 @@ bool SCCP::runOnFunction(Function &F) { } namespace { - Statistic IPNumInstRemoved("ipsccp", "Number of instructions removed"); - Statistic IPNumDeadBlocks ("ipsccp", "Number of basic blocks unreachable"); - Statistic IPNumArgsElimed ("ipsccp", - "Number of arguments constant propagated"); - Statistic IPNumGlobalConst("ipsccp", - "Number of globals found to be constant"); - //===--------------------------------------------------------------------===// // /// IPSCCP Class - This class implements interprocedural Sparse Conditional diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 080d8115ff9..160128eba1d 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -19,6 +19,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "scalarrepl" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -36,12 +37,11 @@ #include "llvm/ADT/StringExtras.h" using namespace llvm; -namespace { - Statistic NumReplaced("scalarrepl", "Number of allocas broken up"); - Statistic NumPromoted("scalarrepl", "Number of allocas promoted"); - Statistic NumConverted("scalarrepl", - "Number of aggregates converted to scalar"); +STATISTIC(NumReplaced, "Number of allocas broken up"); +STATISTIC(NumPromoted, "Number of allocas promoted"); +STATISTIC(NumConverted, "Number of aggregates converted to scalar"); +namespace { struct VISIBILITY_HIDDEN SROA : public FunctionPass { bool runOnFunction(Function &F); diff --git a/lib/Transforms/Scalar/SimplifyCFG.cpp b/lib/Transforms/Scalar/SimplifyCFG.cpp index 175dd3b3bf6..f363a3a5c58 100644 --- a/lib/Transforms/Scalar/SimplifyCFG.cpp +++ b/lib/Transforms/Scalar/SimplifyCFG.cpp @@ -18,6 +18,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "simplifycfg" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Constants.h" @@ -29,9 +30,9 @@ #include using namespace llvm; -namespace { - Statistic NumSimpl("cfgsimplify", "Number of blocks simplified"); +STATISTIC(NumSimpl, "Number of blocks simplified"); +namespace { struct CFGSimplifyPass : public FunctionPass { virtual bool runOnFunction(Function &F); }; diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index 6708418a678..97e8b186e52 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -33,14 +33,12 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; +STATISTIC(NumEliminated, "Number of unconditional branches eliminated"); + namespace { cl::opt Threshold("taildup-threshold", cl::desc("Max block size to tail duplicate"), cl::init(6), cl::Hidden); - Statistic NumEliminated("tailduplicate", - "Number of unconditional branches eliminated"); - Statistic NumPHINodes("tailduplicate", "Number of phi nodes inserted"); - class TailDup : public FunctionPass { bool runOnFunction(Function &F); private: diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp index aca54306692..daa6200871a 100644 --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -50,6 +50,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "tailcallelim" #include "llvm/Transforms/Scalar.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" @@ -60,10 +61,10 @@ #include "llvm/ADT/Statistic.h" using namespace llvm; -namespace { - Statistic NumEliminated("tailcallelim", "Number of tail calls removed"); - Statistic NumAccumAdded("tailcallelim","Number of accumulators introduced"); +STATISTIC(NumEliminated, "Number of tail calls removed"); +STATISTIC(NumAccumAdded, "Number of accumulators introduced"); +namespace { struct TailCallElim : public FunctionPass { virtual bool runOnFunction(Function &F);