[NFC][LoopDeletion] Count the number of broken backedges

Those don't contribute to the number of deleted loops.
This commit is contained in:
Roman Lebedev 2021-10-29 21:58:02 +03:00
parent 35f42340a2
commit 0ae7bf124a
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 4 additions and 0 deletions

View File

@ -36,6 +36,8 @@ using namespace llvm;
#define DEBUG_TYPE "loop-delete"
STATISTIC(NumDeleted, "Number of loops deleted");
STATISTIC(NumBackedgesBroken,
"Number of loops for which we managed to break the backedge");
static cl::opt<bool> EnableSymbolicExecution(
"loop-deletion-enable-symbolic-execution", cl::Hidden, cl::init(true),
@ -409,6 +411,7 @@ breakBackedgeIfNotTaken(Loop *L, DominatorTree &DT, ScalarEvolution &SE,
if (BTC->isZero()) {
// SCEV knows this backedge isn't taken!
breakLoopBackedge(L, DT, SE, LI, MSSA);
++NumBackedgesBroken;
return LoopDeletionResult::Deleted;
}
@ -418,6 +421,7 @@ breakBackedgeIfNotTaken(Loop *L, DominatorTree &DT, ScalarEvolution &SE,
if (isa<SCEVCouldNotCompute>(BTC) || !SE.isKnownNonZero(BTC))
if (canProveExitOnFirstIteration(L, DT, LI)) {
breakLoopBackedge(L, DT, SE, LI, MSSA);
++NumBackedgesBroken;
return LoopDeletionResult::Deleted;
}