From a69696dca625cf9aed22988bd1c0d56a752221f6 Mon Sep 17 00:00:00 2001 From: Jessica Paquette Date: Fri, 31 Aug 2018 22:43:41 +0000 Subject: [PATCH] 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. llvm-svn: 341267 --- llvm/lib/IR/LegacyPassManager.cpp | 2 +- llvm/test/Other/size-remarks.ll | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp index a413f6e..b06d596 100644 --- a/llvm/lib/IR/LegacyPassManager.cpp +++ b/llvm/lib/IR/LegacyPassManager.cpp @@ -1644,7 +1644,7 @@ MPPassManager::runOnModule(Module &M) { int64_t Delta = static_cast(ModuleCount) - static_cast(InstrCount); emitInstrCountChangedRemark(MP, M, Delta, InstrCount); - ModuleCount = InstrCount; + InstrCount = ModuleCount; } } } diff --git a/llvm/test/Other/size-remarks.ll b/llvm/test/Other/size-remarks.ll index 864057b..7fd9642 100644 --- a/llvm/test/Other/size-remarks.ll +++ b/llvm/test/Other/size-remarks.ll @@ -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: -- 2.7.4