OSDN Git Service

[LoopPass] fixing 'Modification' messages in -debug-pass=Executions for loop passes
authorFedor Sergeev <fedor.sergeev@azul.com>
Mon, 19 Nov 2018 15:10:59 +0000 (15:10 +0000)
committerFedor Sergeev <fedor.sergeev@azul.com>
Mon, 19 Nov 2018 15:10:59 +0000 (15:10 +0000)
Legacy loop pass manager is issuing "Made Modification" message after each Loop Pass
run, however condition for issuing it is accumulated among all the runs.
That leads to confusing 'modification' messages as soon as the first modification is done.

Changing condition to be "current pass made modifications", similar to how
it is being done in all other pass managers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@347215 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/LoopPass.cpp

index 4c1bd7a..a68f114 100644 (file)
@@ -216,10 +216,12 @@ bool LPPassManager::runOnFunction(Function &F) {
 
       initializeAnalysisImpl(P);
 
+      bool LocalChanged = false;
       {
         PassManagerPrettyStackEntry X(P, *CurrentLoop->getHeader());
         TimeRegion PassTimer(getPassTimer(P));
-        Changed |= P->runOnLoop(CurrentLoop, *this);
+        LocalChanged = P->runOnLoop(CurrentLoop, *this);
+        Changed |= LocalChanged;
         if (EmitICRemark) {
           unsigned NewSize = F.getInstructionCount();
           // Update the size of the function, emit a remark, and update the
@@ -235,7 +237,7 @@ bool LPPassManager::runOnFunction(Function &F) {
         }
       }
 
-      if (Changed)
+      if (LocalChanged)
         dumpPassInfo(P, MODIFICATION_MSG, ON_LOOP_MSG,
                      CurrentLoopDeleted ? "<deleted loop>"
                                         : CurrentLoop->getName());