[lld] [lld-macho] Fix invalid DWARF with --icf=safe_thunks (PR #111097)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 4 16:46:46 PDT 2024
================
@@ -49,127 +62,179 @@
; CHECK-ARM64-MAP-NEXT: 0x00000004 [ 2] _func_3identical_v2
; CHECK-ARM64-MAP-NEXT: 0x00000004 [ 2] _func_3identical_v3
+; ModuleID = 'icf-safe-thunks.cpp'
+source_filename = "icf-safe-thunks.cpp"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "arm64-apple-macosx11.0.0"
-
- at g_val = global i8 0, align 1
- at g_ptr = global ptr null, align 8
-
+ at g_val = global i8 0, align 1, !dbg !0
+ at g_ptr = global ptr null, align 8, !dbg !7
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @func_unique_1() #0 {
+define void @func_unique_1() #0 !dbg !19 {
entry:
- store volatile i8 1, ptr @g_val, align 1, !tbaa !5
- ret void
+ store volatile i8 1, ptr @g_val, align 1, !dbg !22, !tbaa !23
+ ret void, !dbg !26
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @func_unique_2_canmerge() local_unnamed_addr #0 {
+define void @func_unique_2_canmerge() local_unnamed_addr #0 !dbg !27 {
entry:
- store volatile i8 2, ptr @g_val, align 1, !tbaa !5
- ret void
+ store volatile i8 2, ptr @g_val, align 1, !dbg !28, !tbaa !23
+ ret void, !dbg !29
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @func_2identical_v1() #0 {
+define void @func_2identical_v1() #0 !dbg !30 {
entry:
- store volatile i8 2, ptr @g_val, align 1, !tbaa !5
- ret void
+ store volatile i8 2, ptr @g_val, align 1, !dbg !31, !tbaa !23
+ ret void, !dbg !32
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @func_2identical_v2() #0 {
+define void @func_2identical_v2() #0 !dbg !33 {
entry:
- store volatile i8 2, ptr @g_val, align 1, !tbaa !5
- ret void
+ store volatile i8 2, ptr @g_val, align 1, !dbg !34, !tbaa !23
+ ret void, !dbg !35
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @func_3identical_v1() #0 {
+define void @func_3identical_v1() #0 !dbg !36 {
entry:
- store volatile i8 3, ptr @g_val, align 1, !tbaa !5
- ret void
+ store volatile i8 3, ptr @g_val, align 1, !dbg !37, !tbaa !23
+ ret void, !dbg !38
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @func_3identical_v2() #0 {
+define void @func_3identical_v2() #0 !dbg !39 {
entry:
- store volatile i8 3, ptr @g_val, align 1, !tbaa !5
- ret void
+ store volatile i8 3, ptr @g_val, align 1, !dbg !40, !tbaa !23
+ ret void, !dbg !41
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @func_3identical_v3() #0 {
+define void @func_3identical_v3() #0 !dbg !42 {
entry:
- store volatile i8 3, ptr @g_val, align 1, !tbaa !5
- ret void
+ store volatile i8 3, ptr @g_val, align 1, !dbg !43, !tbaa !23
+ ret void, !dbg !44
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @func_3identical_v1_canmerge() local_unnamed_addr #0 {
+define void @func_3identical_v1_canmerge() local_unnamed_addr #0 !dbg !45 {
entry:
- store volatile i8 33, ptr @g_val, align 1, !tbaa !5
- ret void
+ store volatile i8 33, ptr @g_val, align 1, !dbg !46, !tbaa !23
+ ret void, !dbg !47
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @func_3identical_v2_canmerge() local_unnamed_addr #0 {
+define void @func_3identical_v2_canmerge() local_unnamed_addr #0 !dbg !48 {
entry:
- store volatile i8 33, ptr @g_val, align 1, !tbaa !5
- ret void
+ store volatile i8 33, ptr @g_val, align 1, !dbg !49, !tbaa !23
+ ret void, !dbg !50
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @func_3identical_v3_canmerge() local_unnamed_addr #0 {
+define void @func_3identical_v3_canmerge() local_unnamed_addr #0 !dbg !51 {
entry:
- store volatile i8 33, ptr @g_val, align 1, !tbaa !5
- ret void
+ store volatile i8 33, ptr @g_val, align 1, !dbg !52, !tbaa !23
+ ret void, !dbg !53
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp uwtable(sync)
-define void @call_all_funcs() local_unnamed_addr #1 {
+define void @call_all_funcs() local_unnamed_addr #1 !dbg !54 {
entry:
- tail call void @func_unique_1()
- tail call void @func_unique_2_canmerge()
- tail call void @func_2identical_v1()
- tail call void @func_2identical_v2()
- tail call void @func_3identical_v1()
- tail call void @func_3identical_v2()
- tail call void @func_3identical_v3()
- tail call void @func_3identical_v1_canmerge()
- tail call void @func_3identical_v2_canmerge()
- tail call void @func_3identical_v3_canmerge()
- ret void
+ tail call void @func_unique_1(), !dbg !55
+ tail call void @func_unique_2_canmerge(), !dbg !56
+ tail call void @func_2identical_v1(), !dbg !57
+ tail call void @func_2identical_v2(), !dbg !58
+ tail call void @func_3identical_v1(), !dbg !59
+ tail call void @func_3identical_v2(), !dbg !60
+ tail call void @func_3identical_v3(), !dbg !61
+ tail call void @func_3identical_v1_canmerge(), !dbg !62
+ tail call void @func_3identical_v2_canmerge(), !dbg !63
+ tail call void @func_3identical_v3_canmerge(), !dbg !64
+ ret void, !dbg !65
}
-
; Function Attrs: mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync)
-define void @take_func_addr() local_unnamed_addr #0 {
+define void @take_func_addr() local_unnamed_addr #0 !dbg !66 {
entry:
- store volatile ptr @func_unique_1, ptr @g_ptr, align 8, !tbaa !8
- store volatile ptr @func_2identical_v1, ptr @g_ptr, align 8, !tbaa !8
- store volatile ptr @func_2identical_v2, ptr @g_ptr, align 8, !tbaa !8
- store volatile ptr @func_3identical_v1, ptr @g_ptr, align 8, !tbaa !8
- store volatile ptr @func_3identical_v2, ptr @g_ptr, align 8, !tbaa !8
- store volatile ptr @func_3identical_v3, ptr @g_ptr, align 8, !tbaa !8
- ret void
+ store volatile ptr @func_unique_1, ptr @g_ptr, align 8, !dbg !67, !tbaa !68
+ store volatile ptr @func_2identical_v1, ptr @g_ptr, align 8, !dbg !70, !tbaa !68
+ store volatile ptr @func_2identical_v2, ptr @g_ptr, align 8, !dbg !71, !tbaa !68
+ store volatile ptr @func_3identical_v1, ptr @g_ptr, align 8, !dbg !72, !tbaa !68
+ store volatile ptr @func_3identical_v2, ptr @g_ptr, align 8, !dbg !73, !tbaa !68
+ store volatile ptr @func_3identical_v3, ptr @g_ptr, align 8, !dbg !74, !tbaa !68
+ ret void, !dbg !75
}
-
-attributes #0 = { mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }
-attributes #1 = { mustprogress nofree noinline norecurse nounwind ssp uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }
-
-!llvm.module.flags = !{!0, !1, !2, !3}
-!llvm.ident = !{!4}
-
-!0 = !{i32 1, !"wchar_size", i32 4}
-!1 = !{i32 8, !"PIC Level", i32 2}
-!2 = !{i32 7, !"uwtable", i32 1}
-!3 = !{i32 7, !"frame-pointer", i32 1}
-!4 = !{!"clang"}
-!5 = !{!6, !6, i64 0}
-!6 = !{!"omnipotent char", !7, i64 0}
-!7 = !{!"Simple C++ TBAA"}
-!8 = !{!9, !9, i64 0}
-!9 = !{!"any pointer", !6, i64 0}
-
+attributes #0 = { mustprogress nofree noinline norecurse nounwind ssp memory(readwrite, argmem: none) uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }
+attributes #1 = { mustprogress nofree noinline norecurse nounwind ssp uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }
+!llvm.dbg.cu = !{!2}
+!llvm.module.flags = !{!12, !13, !14, !15, !16, !17}
+!llvm.ident = !{!18}
+!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
+!1 = distinct !DIGlobalVariable(name: "g_val", scope: !2, file: !3, line: 5, type: !10, isLocal: false, isDefinition: true)
+!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 20.0.0git (https://github.com/alx32/llvm-project.git 02d6aad5cc940f17904c1288dfabc3fd2d439279)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: !4, globals: !6, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/")
----------------
kyulee-com wrote:
Can we simplify this? In particular, `producer:`, do we need a specific version with your path?
https://github.com/llvm/llvm-project/pull/111097
More information about the llvm-commits
mailing list