[LoopFlatten] Add statistic for number of loops flattened. NFC

Differential Revision: https://reviews.llvm.org/D108644
This commit is contained in:
Rosie Sumpter 2021-08-24 17:04:35 +01:00
parent 868bd9938d
commit e221724714
1 changed files with 10 additions and 2 deletions

View File

@ -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<unsigned> 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 @@ static bool DoFlattenLoopPair(FlattenInfo &FI, DominatorTree *DT, LoopInfo *LI,
SE->forgetLoop(FI.OuterLoop);
SE->forgetLoop(FI.InnerLoop);
LI->erase(FI.InnerLoop);
// Increment statistic value.
NumFlattened++;
return true;
}