[llvm] r341267 - Fix typo in size remarks for module passes

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 31 15:43:41 PDT 2018


Author: paquette
Date: Fri Aug 31 15:43:41 2018
New Revision: 341267

URL: http://llvm.org/viewvc/llvm-project?rev=341267&view=rev
Log:
Fix typo in size remarks for module passes

ModuleCount = InstrCount was incorrect. It should have been
InstrCount = ModuleCount. This was making it emit an extra, incorrect remark
for Print Module IR.

The test didn't catch this, because it didn't ensure that the only remark
output was from the desired pass. So, it was possible to have an extra remark
come through and not fail. Updated the test so that we ensure that the last
remark that's output comes from the desired pass. This is done by ensuring
that whatever is being read after the last remark is YAML output rather than
some incorrect garbage.

Modified:
    llvm/trunk/lib/IR/LegacyPassManager.cpp
    llvm/trunk/test/Other/size-remarks.ll

Modified: llvm/trunk/lib/IR/LegacyPassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LegacyPassManager.cpp?rev=341267&r1=341266&r2=341267&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LegacyPassManager.cpp (original)
+++ llvm/trunk/lib/IR/LegacyPassManager.cpp Fri Aug 31 15:43:41 2018
@@ -1644,7 +1644,7 @@ MPPassManager::runOnModule(Module &M) {
           int64_t Delta = static_cast<int64_t>(ModuleCount) -
                           static_cast<int64_t>(InstrCount);
           emitInstrCountChangedRemark(MP, M, Delta, InstrCount);
-          ModuleCount = InstrCount;
+          InstrCount = ModuleCount;
         }
       }
     }

Modified: llvm/trunk/test/Other/size-remarks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/size-remarks.ll?rev=341267&r1=341266&r2=341267&view=diff
==============================================================================
--- llvm/trunk/test/Other/size-remarks.ll (original)
+++ llvm/trunk/test/Other/size-remarks.ll Fri Aug 31 15:43:41 2018
@@ -20,7 +20,8 @@
 ; CGSCC-SAME: IR instruction count changed from
 ; CGSCC-SAME: [[ORIG:[1-9][0-9]*]] to [[FINAL:[1-9][0-9]*]];
 ; CGSCC-SAME: Delta: [[DELTA:-?[1-9][0-9]*]]
-; CGSCC: --- !Analysis
+; CGSCC-NEXT: ---
+; CGSCC-DAG: !Analysis
 ; CGSCC-NEXT: Pass:            size-info
 ; CGSCC-NEXT: Name:            IRSizeChange
 ; CGSCC-NEXT: Function:
@@ -44,7 +45,8 @@
 ; FUNC-SAME: IR instruction count changed from
 ; FUNC-SAME: [[SIZE2]] to [[SIZE3:[1-9][0-9]*]];
 ; FUNC-SAME: Delta: [[DELTA2:-?[1-9][0-9]*]]
-; FUNC: --- !Analysis
+; FUNC-NEXT: ---
+; FUNC-DAG: !Analysis
 ; FUNC-NEXT: Pass:            size-info
 ; FUNC-NEXT: Name:            IRSizeChange
 ; FUNC-NEXT: Function:
@@ -77,7 +79,8 @@
 ; MODULE-SAME: IR instruction count changed from
 ; MODULE-SAME: [[ORIG:[1-9][0-9]*]] to [[FINAL:[1-9][0-9]*]];
 ; MODULE-SAME: Delta: [[DELTA:-?[1-9][0-9]*]]
-; MODULE: --- !Analysis
+; MODULE-NEXT: ---
+; MODULE-DAG: !Analysis
 ; MODULE-NEXT: Pass:            size-info
 ; MODULE-NEXT: Name:            IRSizeChange
 ; MODULE-NEXT: Function:
@@ -97,7 +100,8 @@
 ; BB-SAME: IR instruction count changed from
 ; BB-SAME: [[ORIG:[1-9][0-9]*]] to [[FINAL:[1-9][0-9]*]];
 ; BB-SAME: Delta: [[DELTA:-?[1-9][0-9]*]]
-; BB: --- !Analysis
+; BB-NEXT: ---
+; BB-DAG: !Analysis
 ; BB-NEXT: Pass:            size-info
 ; BB-NEXT: Name:            IRSizeChange
 ; BB-NEXT: Function:
@@ -117,7 +121,8 @@
 ; LOOP-SAME: IR instruction count changed from
 ; LOOP-SAME: [[ORIG:[1-9][0-9]*]] to [[FINAL:[1-9][0-9]*]];
 ; LOOP-SAME: Delta: [[DELTA:-?[1-9][0-9]*]]
-; LOOP: --- !Analysis
+; LOOP-NEXT: ---
+; LOOP-DAG: !Analysis
 ; LOOP-NEXT: Pass:            size-info
 ; LOOP-NEXT: Name:            IRSizeChange
 ; LOOP-NEXT: Function:




More information about the llvm-commits mailing list