diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp index 2c68e4b3c32e35..200993f92573ea 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 @@ -424,11 +428,13 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { !Inst->mayWriteToMemory() && !Inst->isTerminator() && !isa(Inst) && !isa(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,