[llvm] dfa8d33 - DebugInfo: Update ranges_always.ll to include more details about how to generate the IR

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 12 13:02:57 PDT 2021


Author: David Blaikie
Date: 2021-10-12T13:02:47-07:00
New Revision: dfa8d33eea4122a9864647d8e31acaf0e8acff84

URL: https://github.com/llvm/llvm-project/commit/dfa8d33eea4122a9864647d8e31acaf0e8acff84
DIFF: https://github.com/llvm/llvm-project/commit/dfa8d33eea4122a9864647d8e31acaf0e8acff84.diff

LOG: DebugInfo: Update ranges_always.ll to include more details about how to generate the IR

Also modify the test to be more robust (current IR generation doesn't
include call sites for callees that are only declared but not defined -
so the test case couldn't be regenerated - add a function definition (&
optnone attribute) so it doesn't depend on call sites for
declared-but-not-defined functions)

Added: 
    

Modified: 
    llvm/test/DebugInfo/X86/ranges_always.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/DebugInfo/X86/ranges_always.ll b/llvm/test/DebugInfo/X86/ranges_always.ll
index 38581b83ea323..217d947002a3b 100644
--- a/llvm/test/DebugInfo/X86/ranges_always.ll
+++ b/llvm/test/DebugInfo/X86/ranges_always.ll
@@ -30,7 +30,9 @@
 ; the CU ranges are in the same section, then picking the lowest such address as
 ; the base address to make all other addresses relative to)
 
-; void f1();
+; IR from the following, compiled with:
+; $ clang -g -c -gdwarf-5 -O1
+; __attribute__((optnone)) void f1() { }
 ; __attribute__((always_inline)) inline void f2() {
 ;   f1();
 ; }
@@ -48,55 +50,65 @@
 ; CHECK-LABEL: .debug_info contents:
 ; CHECK: DW_TAG_compile_unit
 ; CHECK:   DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)
-; RNG:     DW_AT_ranges [DW_FORM_rnglistx]   (indexed (0x2) rangelist = [[CU_RANGE:.*]]
+; RNG:     DW_AT_ranges [DW_FORM_rnglistx]   (indexed (0x3) rangelist = [[CU_RANGE:.*]]
 ; EXPRORFORM: DW_AT_ranges [DW_FORM_rnglistx]   (indexed (0x0) rangelist = [[CU_RANGE:.*]]
 ; CHECK:   DW_TAG_subprogram
+; CHECK:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000000) address = 0x0000000000000000 ".text")
+; CHECK:     DW_AT_high_pc [DW_FORM_data4]   (0x00000001)
+; CHECK:     DW_AT_name {{.*}} "f1"
+; CHECK:   DW_TAG_subprogram
 ; CHECK:     DW_AT_name {{.*}} "f2"
 ; CHECK:   DW_TAG_subprogram
-; CHECK:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000000) address = 0x0000000000000000 ".text")
-; CHECK:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
+; EXPR:      DW_AT_low_pc [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_const4u 0x10, DW_OP_plus)
+; FORM:      DW_AT_low_pc [DW_FORM_LLVM_addrx_offset] (indexed (00000000) + 0x10 address = 0x0000000000000010 ".text")
+; EXPRORFORM: DW_AT_high_pc [DW_FORM_data4]   (0x0000000d)
+; RNG:       DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = [[F3_RANGE:.*]]
+; CHECK:     DW_AT_name {{.*}} "f3"
 ; CHECK:     DW_TAG_inlined_subroutine
-; EXPR:        DW_AT_low_pc [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_const4u 0x9, DW_OP_plus)
-; FORM:        DW_AT_low_pc [DW_FORM_LLVM_addrx_offset] (indexed (00000000) + 0x9 address = 0x0000000000000009 ".text")
+; EXPR:        DW_AT_low_pc [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_const4u 0x16, DW_OP_plus)
+; FORM:        DW_AT_low_pc [DW_FORM_LLVM_addrx_offset] (indexed (00000000) + 0x16 address = 0x0000000000000016 ".text")
 ; EXPRORFORM:  DW_AT_high_pc [DW_FORM_data4]   (0x00000005)
-; RNG:         DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x0) rangelist = [[INL_RANGE:.*]]
+; RNG:         DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = [[INL_RANGE:.*]]
 ; CHECK:     DW_TAG_call_site
-; RNG:         DW_AT_call_return_pc [DW_FORM_addrx]  (indexed (00000001) address = 0x0000000000000009 ".text")
-; EXPR:        DW_AT_call_return_pc [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_const4u 0x9, DW_OP_plus)
-; FORM:        DW_AT_call_return_pc [DW_FORM_LLVM_addrx_offset] (indexed (00000000) + 0x9 address = 0x0000000000000009 ".text")
+; RNG:         DW_AT_call_return_pc [DW_FORM_addrx]  (indexed (00000001) address = 0x0000000000000016 ".text")
+; EXPR:        DW_AT_call_return_pc [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_const4u 0x16, DW_OP_plus)
+; FORM:        DW_AT_call_return_pc [DW_FORM_LLVM_addrx_offset] (indexed (00000000) + 0x16 address = 0x0000000000000016 ".text")
 ; CHECK:     DW_TAG_call_site
-; RNG:         DW_AT_call_return_pc [DW_FORM_addrx]  (indexed (00000002) address = 0x000000000000000e ".text")
-; EXPR:        DW_AT_call_return_pc [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_const4u 0xe, DW_OP_plus)
-; FORM:        DW_AT_call_return_pc [DW_FORM_LLVM_addrx_offset] (indexed (00000000) + 0xe address = 0x000000000000000e ".text")
+; RNG:         DW_AT_call_return_pc [DW_FORM_addrx]  (indexed (00000002) address = 0x000000000000001b ".text")
+; EXPR:        DW_AT_call_return_pc [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_const4u 0x1b, DW_OP_plus)
+; FORM:        DW_AT_call_return_pc [DW_FORM_LLVM_addrx_offset] (indexed (00000000) + 0x1b address = 0x000000000000001b ".text")
 ; CHECK:     NULL
 ; CHECK:   DW_TAG_subprogram
-; CHECK:     DW_AT_name {{.*}} "f1"
-; CHECK:   DW_TAG_subprogram
-; EXPR:      DW_AT_low_pc [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_const4u 0x20, DW_OP_plus)
-; FORM:      DW_AT_low_pc [DW_FORM_LLVM_addrx_offset] (indexed (00000000) + 0x20 address = 0x0000000000000020 ".text")
-; EXPRORFORM: DW_AT_high_pc [DW_FORM_data4]   (0x00000006)
-; RNG:       DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x1) rangelist = [[F5_RANGE:.*]]
+; EXPR:      DW_AT_low_pc [DW_FORM_exprloc] (DW_OP_addrx 0x0, DW_OP_const4u 0x30, DW_OP_plus)
+; FORM:      DW_AT_low_pc [DW_FORM_LLVM_addrx_offset] (indexed (00000000) + 0x30 address = 0x0000000000000030 ".text")
+; EXPRORFORM: DW_AT_high_pc [DW_FORM_data4]   (0x00000001)
+; RNG:       DW_AT_ranges [DW_FORM_rnglistx] (indexed (0x2) rangelist = [[F5_RANGE:.*]]
+; CHECK:     DW_AT_name {{.*}} "f5"
 ; CHECK:   DW_TAG_subprogram
 ; CHECK:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (
 ; RNG-SAME: 00000003
 ; EXPRORFORM-SAME: 00000001
 ; CHECK: ) address = 0x0000000000000000 ".other")
-; CHECK:     DW_AT_high_pc [DW_FORM_data4]   (0x00000006)
+; CHECK:     DW_AT_high_pc [DW_FORM_data4]   (0x00000001)
 ; CHECK:   NULL
 
 ; CHECK-LABEL: .debug_addr contents:
 ; CHECK: 0x00000000: Address table
 ; CHECK-NEXT: Addrs: [
 ; CHECK-NEXT: 0x0000000000000000
-; RNG-NEXT:   0x0000000000000009
-; RNG-NEXT:   0x000000000000000e
+; RNG-NEXT:   0x0000000000000016
+; RNG-NEXT:   0x000000000000001b
 ; CHECK-NEXT: 0x0000000000000000
 ; CHECK-NEXT: ]
 
 ; CHECK-LABEL: .debug_rnglists contents:
-; RNG: 0x00000000: range list header: {{.*}}, offset_entry_count = 0x00000003
+; RNG: 0x00000000: range list header: {{.*}}, offset_entry_count = 0x00000004
 ; EXPRORFORM: 0x00000000: range list header: {{.*}}, offset_entry_count = 0x00000001
 ; CHECK: ranges:
+; RNG-NEXT:   [[F3_RANGE]]: [DW_RLE_base_addressx]:  0x0000000000000000
+; RNG-NEXT:                 [DW_RLE_offset_pair  ]
+; RNG-NEXT:                 [DW_RLE_end_of_list  ]
+
 ; RNG-NEXT:   [[INL_RANGE]]: [DW_RLE_base_addressx]:  0x0000000000000000
 ; RNG-NEXT:                  [DW_RLE_offset_pair  ]
 ; RNG-NEXT:                  [DW_RLE_end_of_list  ]
@@ -112,59 +124,67 @@
 ; EXPRORFORM-NEXT:          [DW_RLE_startx_length]:  0x0000000000000001
 ; CHECK-NEXT:               [DW_RLE_end_of_list  ]
 
-; Function Attrs: noinline optnone uwtable mustprogress
-define dso_local void @_Z2f3v() #0 !dbg !7 {
+; Function Attrs: mustprogress noinline nounwind optnone uwtable
+define dso_local void @_Z2f1v() local_unnamed_addr #0 !dbg !7 {
 entry:
-  call void @_Z2f1v(), !dbg !10
-  call void @_Z2f1v(), !dbg !11
-  ret void, !dbg !14
+  ret void, !dbg !12
 }
 
-declare !dbg !19 dso_local void @_Z2f1v() #1
+; Function Attrs: mustprogress nounwind uwtable
+define dso_local void @_Z2f3v() local_unnamed_addr #1 !dbg !13 {
+entry:
+  call void @_Z2f1v(), !dbg !14
+  call void @_Z2f1v() #3, !dbg !15
+  ret void, !dbg !18
+}
 
-; Function Attrs: noinline nounwind optnone uwtable mustprogress
-define dso_local void @_Z2f4v() #2 {
+; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone uwtable willreturn
+define dso_local void @_Z2f4v() local_unnamed_addr #2 {
 entry:
   ret void
 }
 
-; Function Attrs: noinline nounwind optnone uwtable mustprogress
-define dso_local void @_Z2f5v() #2 !dbg !15 {
+; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone uwtable willreturn
+define dso_local void @_Z2f5v() local_unnamed_addr #2 !dbg !19 {
 entry:
-  ret void, !dbg !16
+  ret void, !dbg !20
 }
 
-; Function Attrs: noinline nounwind optnone uwtable mustprogress
-define dso_local void @_Z2f6v() #2 section ".other" !dbg !17 {
+; Function Attrs: mustprogress nofree norecurse nosync nounwind readnone uwtable willreturn
+define dso_local void @_Z2f6v() local_unnamed_addr #2 section ".other" !dbg !21 {
 entry:
-  ret void, !dbg !18
+  ret void, !dbg !22
 }
 
-attributes #0 = { noinline optnone uwtable mustprogress "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #2 = { noinline nounwind optnone uwtable mustprogress "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #0 = { mustprogress noinline nounwind optnone uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #1 = { mustprogress nounwind uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #2 = { mustprogress nofree norecurse nosync nounwind readnone uwtable willreturn "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
+attributes #3 = { nounwind }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5}
+!llvm.module.flags = !{!2, !3, !4, !5}
 !llvm.ident = !{!6}
 
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0 (git at github.com:llvm/llvm-project.git 79afdd7d36b814942ec7f2f577d0443f6aecc939)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
-!1 = !DIFile(filename: "ranges_always.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch", checksumkind: CSK_MD5, checksum: "25fb47763043609a0aac0ab69baa803d")
-!2 = !{}
-!3 = !{i32 7, !"Dwarf Version", i32 5}
-!4 = !{i32 2, !"Debug Info Version", i32 3}
-!5 = !{i32 1, !"wchar_size", i32 4}
-!6 = !{!"clang version 12.0.0 (git at github.com:llvm/llvm-project.git 79afdd7d36b814942ec7f2f577d0443f6aecc939)"}
-!7 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !1, file: !1, line: 5, type: !8, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
-!8 = !DISubroutineType(types: !9)
-!9 = !{null}
-!10 = !DILocation(line: 6, column: 3, scope: !7)
-!11 = !DILocation(line: 3, column: 3, scope: !12, inlinedAt: !13)
-!12 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
-!13 = distinct !DILocation(line: 7, column: 3, scope: !7)
-!14 = !DILocation(line: 8, column: 1, scope: !7)
-!15 = distinct !DISubprogram(name: "f5", linkageName: "_Z2f5v", scope: !1, file: !1, line: 11, type: !8, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
-!16 = !DILocation(line: 12, column: 1, scope: !15)
-!17 = distinct !DISubprogram(name: "f6", linkageName: "_Z2f6v", scope: !1, file: !1, line: 13, type: !8, scopeLine: 13, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
-!18 = !DILocation(line: 14, column: 1, scope: !17)
-!19 = !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !1, file: !1, line: 1, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 14.0.0 (git at github.com:llvm/llvm-project.git e2c3dc6fc76e767f08249f6d2c36e41660a4e331)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "/usr/local/google/home/blaikie/dev/scratch/test.cpp", directory: "/usr/local/google/home/blaikie/dev/llvm/src", checksumkind: CSK_MD5, checksum: "3f22f50a63567e0643469021f6ccc6d5")
+!2 = !{i32 7, !"Dwarf Version", i32 5}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!4 = !{i32 1, !"wchar_size", i32 4}
+!5 = !{i32 7, !"uwtable", i32 1}
+!6 = !{!"clang version 14.0.0 (git at github.com:llvm/llvm-project.git e2c3dc6fc76e767f08249f6d2c36e41660a4e331)"}
+!7 = distinct !DISubprogram(name: "f1", linkageName: "_Z2f1v", scope: !8, file: !8, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
+!8 = !DIFile(filename: "scratch/test.cpp", directory: "/usr/local/google/home/blaikie/dev", checksumkind: CSK_MD5, checksum: "3f22f50a63567e0643469021f6ccc6d5")
+!9 = !DISubroutineType(types: !10)
+!10 = !{null}
+!11 = !{}
+!12 = !DILocation(line: 1, column: 38, scope: !7)
+!13 = distinct !DISubprogram(name: "f3", linkageName: "_Z2f3v", scope: !8, file: !8, line: 5, type: !9, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
+!14 = !DILocation(line: 6, column: 3, scope: !13)
+!15 = !DILocation(line: 3, column: 3, scope: !16, inlinedAt: !17)
+!16 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !8, file: !8, line: 2, type: !9, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
+!17 = distinct !DILocation(line: 7, column: 3, scope: !13)
+!18 = !DILocation(line: 8, column: 1, scope: !13)
+!19 = distinct !DISubprogram(name: "f5", linkageName: "_Z2f5v", scope: !8, file: !8, line: 11, type: !9, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
+!20 = !DILocation(line: 12, column: 1, scope: !19)
+!21 = distinct !DISubprogram(name: "f6", linkageName: "_Z2f6v", scope: !8, file: !8, line: 13, type: !9, scopeLine: 13, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
+!22 = !DILocation(line: 14, column: 1, scope: !21)


        


More information about the llvm-commits mailing list