}
// Walk Loops
- unsigned InstrCount = 0;
+ unsigned InstrCount, FunctionSize = 0;
bool EmitICRemark = M.shouldEmitInstrCountChangedRemark();
+ // Collect the initial size of the module and the function we're looking at.
+ if (EmitICRemark) {
+ InstrCount = initSizeRemarkInfo(M);
+ FunctionSize = F.getInstructionCount();
+ }
while (!LQ.empty()) {
CurrentLoopDeleted = false;
CurrentLoop = LQ.back();
{
PassManagerPrettyStackEntry X(P, *CurrentLoop->getHeader());
TimeRegion PassTimer(getPassTimer(P));
- if (EmitICRemark)
- InstrCount = initSizeRemarkInfo(M);
Changed |= P->runOnLoop(CurrentLoop, *this);
- if (EmitICRemark)
- emitInstrCountChangedRemark(P, M, InstrCount);
+ if (EmitICRemark) {
+ unsigned NewSize = F.getInstructionCount();
+ // Update the size of the function, emit a remark, and update the
+ // size of the module.
+ if (NewSize != FunctionSize) {
+ emitInstrCountChangedRemark(P, M, InstrCount);
+ int64_t Delta = static_cast<int64_t>(NewSize) -
+ static_cast<int64_t>(FunctionSize);
+ InstrCount = static_cast<int64_t>(InstrCount) + Delta;
+ FunctionSize = NewSize;
+ }
+ }
}
if (Changed)