forked from OSchip/llvm-project
[LoopFlatten] Add statistic for number of loops flattened. NFC
Differential Revision: https://reviews.llvm.org/D108644
This commit is contained in:
parent
868bd9938d
commit
e221724714
|
@ -27,6 +27,8 @@
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
#include "llvm/Transforms/Scalar/LoopFlatten.h"
|
#include "llvm/Transforms/Scalar/LoopFlatten.h"
|
||||||
|
|
||||||
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/Analysis/AssumptionCache.h"
|
#include "llvm/Analysis/AssumptionCache.h"
|
||||||
#include "llvm/Analysis/LoopInfo.h"
|
#include "llvm/Analysis/LoopInfo.h"
|
||||||
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
|
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
|
||||||
|
@ -49,11 +51,13 @@
|
||||||
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
|
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
|
||||||
#include "llvm/Transforms/Utils/SimplifyIndVar.h"
|
#include "llvm/Transforms/Utils/SimplifyIndVar.h"
|
||||||
|
|
||||||
#define DEBUG_TYPE "loop-flatten"
|
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
using namespace llvm::PatternMatch;
|
using namespace llvm::PatternMatch;
|
||||||
|
|
||||||
|
#define DEBUG_TYPE "loop-flatten"
|
||||||
|
|
||||||
|
STATISTIC(NumFlattened, "Number of loops flattened");
|
||||||
|
|
||||||
static cl::opt<unsigned> RepeatedInstructionThreshold(
|
static cl::opt<unsigned> RepeatedInstructionThreshold(
|
||||||
"loop-flatten-cost-threshold", cl::Hidden, cl::init(2),
|
"loop-flatten-cost-threshold", cl::Hidden, cl::init(2),
|
||||||
cl::desc("Limit on the cost of instructions that can be repeated due to "
|
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.OuterLoop);
|
||||||
SE->forgetLoop(FI.InnerLoop);
|
SE->forgetLoop(FI.InnerLoop);
|
||||||
LI->erase(FI.InnerLoop);
|
LI->erase(FI.InnerLoop);
|
||||||
|
|
||||||
|
// Increment statistic value.
|
||||||
|
NumFlattened++;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue