[llvm] 0ae7bf1 - [NFC][LoopDeletion] Count the number of broken backedges

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 29 11:58:42 PDT 2021


Author: Roman Lebedev
Date: 2021-10-29T21:58:16+03:00
New Revision: 0ae7bf124a9bca76dd9a91b2f7379168ff13f562

URL: https://github.com/llvm/llvm-project/commit/0ae7bf124a9bca76dd9a91b2f7379168ff13f562
DIFF: https://github.com/llvm/llvm-project/commit/0ae7bf124a9bca76dd9a91b2f7379168ff13f562.diff

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

Those don't contribute to the number of deleted loops.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LoopDeletion.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
index 03f7f259aa2f..5814e2f043d5 100644
--- a/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopDeletion.cpp
@@ -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;
     }
 


        


More information about the llvm-commits mailing list