diff --git a/llvm/lib/Transforms/Scalar/LoopFlatten.cpp b/llvm/lib/Transforms/Scalar/LoopFlatten.cpp --- a/llvm/lib/Transforms/Scalar/LoopFlatten.cpp +++ b/llvm/lib/Transforms/Scalar/LoopFlatten.cpp @@ -27,6 +27,8 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar/LoopFlatten.h" + +#include "llvm/ADT/Statistic.h" #include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/OptimizationRemarkEmitter.h" @@ -49,11 +51,13 @@ #include "llvm/Transforms/Utils/ScalarEvolutionExpander.h" #include "llvm/Transforms/Utils/SimplifyIndVar.h" -#define DEBUG_TYPE "loop-flatten" - using namespace llvm; using namespace llvm::PatternMatch; +#define DEBUG_TYPE "loop-flatten" + +STATISTIC(NumFlattened, "Number of loops flattened"); + static cl::opt RepeatedInstructionThreshold( "loop-flatten-cost-threshold", cl::Hidden, cl::init(2), cl::desc("Limit on the cost of instructions that can be repeated due to " @@ -630,6 +634,10 @@ SE->forgetLoop(FI.OuterLoop); SE->forgetLoop(FI.InnerLoop); LI->erase(FI.InnerLoop); + + // Increment statistic value. + NumFlattened++; + return true; }