[PATCH] D109737: [LTO] Emit DebugLoc for dead function in optimization remarks
Xu Mingjie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 14 00:43:07 PDT 2021
Enna1 updated this revision to Diff 372420.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109737/new/
https://reviews.llvm.org/D109737
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
@@ -19,9 +19,11 @@
; REMARK: Pass: lto
; REMARK-NEXT: Name: deadfunction
+; REMARK-NEXT: DebugLoc: { File: test.c, Line: 4, Column: 0 }
; REMARK-NEXT: Function: dead2
; REMARK-NEXT: Args:
; REMARK-NEXT: - Function: dead2
+; REMARK-NEXT: DebugLoc: { File: test.c, Line: 4, Column: 0 }
; REMARK-NEXT: - String: ' not added to the combined module '
; FULL-NOT: dead
@@ -48,9 +50,18 @@
ret void
}
-define void @dead2() {
+define void @dead2() !dbg !7 {
ret void
}
-!0 = !{i32 1, !"ThinLTO", i32 0}
-!llvm.module.flags = !{ !0 }
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4, !5}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: false, emissionKind: LineTablesOnly, enums: !2)
+!1 = !DIFile(filename: "test.c", directory: "/")
+!2 = !{}
+!3 = !{i32 2, !"Dwarf Version", i32 2}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"ThinLTO", i32 0}
+!7 = distinct !DISubprogram(name: "dead2", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: false, unit: !0, retainedNodes: !2)
+!8 = !DISubroutineType(types: !2)
Index: llvm/lib/LTO/LTO.cpp
===================================================================
--- llvm/lib/LTO/LTO.cpp
+++ llvm/lib/LTO/LTO.cpp
@@ -857,6 +857,8 @@
for (GlobalValue *GV : Mod.Keep) {
if (LivenessFromIndex && !ThinLTO.CombinedIndex.isGUIDLive(GV->getGUID())) {
if (Function *F = dyn_cast<Function>(GV)) {
+ if (Error Err = F->materialize())
+ return Err;
OptimizationRemarkEmitter ORE(F, nullptr);
ORE.emit(OptimizationRemark(DEBUG_TYPE, "deadfunction", F)
<< ore::NV("Function", F)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109737.372420.patch
Type: text/x-patch
Size: 2003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210914/eca54d45/attachment.bin>
More information about the llvm-commits
mailing list