[PATCH] D84715: [FIX] Avoid creating BFI when emitting remarks for dead functions

Wei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 20:53:23 PDT 2020


weiwang updated this revision to Diff 286471.
weiwang added a comment.

add comment on test case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84715/new/

https://reviews.llvm.org/D84715

Files:
  llvm/lib/LTO/LTO.cpp
  llvm/test/LTO/Resolution/X86/dead-strip-fulllto.ll


Index: llvm/test/LTO/Resolution/X86/dead-strip-fulllto.ll
===================================================================
--- llvm/test/LTO/Resolution/X86/dead-strip-fulllto.ll
+++ llvm/test/LTO/Resolution/X86/dead-strip-fulllto.ll
@@ -1,7 +1,8 @@
 ; RUN: opt -module-summary -o %t %s
 ; RUN: opt -module-summary -o %t2 %S/Inputs/dead-strip-fulllto.ll
 
-; RUN: llvm-lto2 run --pass-remarks-output=%t4.yaml --pass-remarks-filter=. \
+; Adding '--pass-remarks-with-hotness' should not cause crash.
+; RUN: llvm-lto2 run --pass-remarks-output=%t4.yaml --pass-remarks-filter=. --pass-remarks-with-hotness \
 ; RUN:               %t -r %t,main,px -r %t,live1, -r %t,live2,p -r %t,dead2,p \
 ; RUN:               %t2 -r %t2,live1,p -r %t2,live2, -r %t2,dead1,p -r %t2,dead2, -r %t2,odr, \
 ; RUN:               -save-temps -o %t3
Index: llvm/lib/LTO/LTO.cpp
===================================================================
--- llvm/lib/LTO/LTO.cpp
+++ llvm/lib/LTO/LTO.cpp
@@ -798,7 +798,7 @@
   for (GlobalValue *GV : Mod.Keep) {
     if (LivenessFromIndex && !ThinLTO.CombinedIndex.isGUIDLive(GV->getGUID())) {
       if (Function *F = dyn_cast<Function>(GV)) {
-        OptimizationRemarkEmitter ORE(F);
+        OptimizationRemarkEmitter ORE(F, nullptr);
         ORE.emit(OptimizationRemark(DEBUG_TYPE, "deadfunction", F)
                  << ore::NV("Function", F)
                  << " not added to the combined module ");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84715.286471.patch
Type: text/x-patch
Size: 1433 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200819/051fcdc5/attachment.bin>


More information about the llvm-commits mailing list