[NFC][LoopRotation] Count the number of instructions hoisted/cloned into preheader
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 31 Mar 2021 20:23:57 +0000 (23:23 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 31 Mar 2021 20:27:36 +0000 (23:27 +0300)
llvm/lib/Transforms/Utils/LoopRotationUtils.cpp

index 2c68e4b..200993f 100644 (file)
@@ -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,