[llvm] 43ded90 - [NFC][LoopRotation] Count the number of instructions hoisted/cloned into preheader

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 31 13:27:45 PDT 2021


Author: Roman Lebedev
Date: 2021-03-31T23:27:36+03:00
New Revision: 43ded90094f761a4763497773e722c196c69d17e

URL: https://github.com/llvm/llvm-project/commit/43ded90094f761a4763497773e722c196c69d17e
DIFF: https://github.com/llvm/llvm-project/commit/43ded90094f761a4763497773e722c196c69d17e.diff

LOG: [NFC][LoopRotation] Count the number of instructions hoisted/cloned into preheader

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/LoopRotationUtils.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index 2c68e4b3c32e3..200993f92573e 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -46,6 +46,10 @@ using namespace llvm;
 
 STATISTIC(NumNotRotatedDueToHeaderSize,
           "Number of loops not rotated due to the header size");
+STATISTIC(NumInstrsHoisted,
+          "Number of instructions hoisted into loop preheader");
+STATISTIC(NumInstrsDuplicated,
+          "Number of instructions cloned into loop preheader");
 STATISTIC(NumRotated, "Number of loops rotated");
 
 static cl::opt<bool>
@@ -424,11 +428,13 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
           !Inst->mayWriteToMemory() && !Inst->isTerminator() &&
           !isa<DbgInfoIntrinsic>(Inst) && !isa<AllocaInst>(Inst)) {
         Inst->moveBefore(LoopEntryBranch);
+        ++NumInstrsHoisted;
         continue;
       }
 
       // Otherwise, create a duplicate of the instruction.
       Instruction *C = Inst->clone();
+      ++NumInstrsDuplicated;
 
       // Eagerly remap the operands of the instruction.
       RemapInstruction(C, ValueMap,


        


More information about the llvm-commits mailing list