[llvm] 772847a - [NFC] Combine several DW_AT_const_value tests

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 04:16:11 PDT 2023


Author: OCHyams
Date: 2023-06-13T12:15:01+01:00
New Revision: 772847af2a12342e3c7523d3289db81a06cb8ced

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

LOG: [NFC] Combine several DW_AT_const_value tests

Split from D151795. I'm not sure it's conclusive, but these are all the related
tests I could find easily.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D152719

Added: 
    llvm/test/DebugInfo/X86/DW_AT_const_value.ll

Modified: 
    

Removed: 
    llvm/test/DebugInfo/X86/DW_ATE_complex_float.ll
    llvm/test/DebugInfo/X86/dbg-const-int.ll
    llvm/test/DebugInfo/X86/dbg-i128-const.ll
    llvm/test/DebugInfo/X86/float_const.ll


################################################################################
diff  --git a/llvm/test/DebugInfo/X86/DW_ATE_complex_float.ll b/llvm/test/DebugInfo/X86/DW_ATE_complex_float.ll
deleted file mode 100644
index bee40242eb375..0000000000000
--- a/llvm/test/DebugInfo/X86/DW_ATE_complex_float.ll
+++ /dev/null
@@ -1,44 +0,0 @@
-; RUN: llc %s -o - | FileCheck %s
-
-;; Check a single location variable of type DW_ATE_complex_float with a
-;; constant value is emitted with a DW_AT_const_value attribute.
-
-;; Modified from C source input:
-;; #include <complex.h>
-;; void f() { double complex r1; }
-
-; CHECK: .Ldebug_info_start0:
-; CHECK:      .byte [[#]]              # Abbrev {{.*}} DW_TAG_variable
-; CHECK-NEXT: .byte 0                  # DW_AT_const_value
-; CHECK-NEXT: .byte [[str_idx:[0-9]+]] # DW_AT_name
-
-; CHECK: .Linfo_string[[str_idx]]:
-; CHECK-NEXT: .asciz "r1"
-
-target triple = "x86_64-unknown-linux-gnu"
-
-define dso_local void @f() local_unnamed_addr !dbg !10 {
-entry:
-  call void @llvm.dbg.value(metadata i8 0, metadata !14, metadata !DIExpression()), !dbg !17
-  ret void, !dbg !19
-}
-
-declare void @llvm.dbg.value(metadata, metadata, metadata)
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!2, !3}
-!llvm.ident = !{!9}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 17.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
-!1 = !DIFile(filename: "test.c", directory: "/")
-!2 = !{i32 7, !"Dwarf Version", i32 5}
-!3 = !{i32 2, !"Debug Info Version", i32 3}
-!9 = !{!"clang version 17.0.0"}
-!10 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 2, type: !11, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13)
-!11 = !DISubroutineType(types: !12)
-!12 = !{null}
-!13 = !{!14}
-!14 = !DILocalVariable(name: "r1", scope: !10, file: !1, line: 3, type: !15)
-!15 = !DIBasicType(name: "complex", size: 128, encoding: DW_ATE_complex_float)
-!17 = !DILocation(line: 0, scope: !10)
-!19 = !DILocation(line: 4, column: 1, scope: !10)

diff  --git a/llvm/test/DebugInfo/X86/DW_AT_const_value.ll b/llvm/test/DebugInfo/X86/DW_AT_const_value.ll
new file mode 100644
index 0000000000000..39d718a457d35
--- /dev/null
+++ b/llvm/test/DebugInfo/X86/DW_AT_const_value.ll
@@ -0,0 +1,88 @@
+; RUN: llc %s -o - | FileCheck %s
+
+;; Check single location variables of various types with a constant value are
+;; emitted with a DW_AT_const_value attribute.
+
+;; DW_ATE_complex_float
+;; Modified from C source input:
+;; #include <complex.h>
+;; void f() { double complex r1; }
+; CHECK: .Ldebug_info_start0:
+; CHECK:      .byte [[#]]                  # Abbrev {{.*}} DW_TAG_variable
+; CHECK-NEXT: .byte 0                      # DW_AT_const_value
+; CHECK-NEXT: .byte [[r1_str_idx:[0-9]+]]  # DW_AT_name
+
+;; DW_ATE_float
+;; from (at -Os):
+;; void foo() {
+;;   float a = 3.14;
+;;   *(int *)&a = 0;
+;; }
+; CHECK:      .byte [[#]]                  # Abbrev {{.*}} DW_TAG_variable
+; CHECK-NEXT: .byte 0                      # DW_AT_const_value
+; CHECK-NEXT: .byte [[a_str_idx:[0-9]+]]   # DW_AT_name
+
+;; DW_ATE_signed (i128)
+; CHECK:      .byte [[#]]                  # Abbrev {{.*}} DW_TAG_variable
+; CHECK-NEXT: .byte 16                     # DW_AT_const_value
+; CHECK-NEXT: .byte 42
+; CHECK-COUNT-15: .byte 0
+; CHECK-NEXT: .byte [[MAX_str_idx:[0-9]+]] # DW_AT_name
+
+;; DW_ATE_signed (i32)
+; CHECK:      .byte [[#]]                  # Abbrev {{.*}} DW_TAG_variable
+; CHECK-NEXT: .byte 42                     # DW_AT_const_value
+; CHECK-NEXT: .byte [[i_str_idx:[0-9]+]]   # DW_AT_name
+
+; CHECK: .Linfo_string[[r1_str_idx]]:
+; CHECK-NEXT: .asciz "r1"
+; CHECK: .Linfo_string[[a_str_idx]]:
+; CHECK-NEXT: .asciz "a"
+; CHECK: .Linfo_string[[MAX_str_idx]]:
+; CHECK-NEXT: .asciz "MAX"
+; CHECK: .Linfo_string[[i_str_idx]]:
+; CHECK-NEXT: .asciz "i"
+
+target triple = "x86_64-unknown-linux-gnu"
+
+define dso_local void @f() local_unnamed_addr !dbg !10 {
+entry:
+  ;; DW_ATE_complex_float
+  call void @llvm.dbg.value(metadata i8 0, metadata !14, metadata !DIExpression()), !dbg !17
+  ;; DW_ATE_float
+  call void @llvm.dbg.declare(metadata ptr undef, metadata !20, metadata !DIExpression()), !dbg !17
+  call void @llvm.dbg.value(metadata i32 1078523331, metadata !20, metadata !DIExpression()), !dbg !17
+  call void @llvm.dbg.value(metadata i32 0, metadata !20, metadata !DIExpression()), !dbg !17
+  ;; DW_ATE_signed
+  call void @llvm.dbg.value(metadata i128 42 , metadata !22, metadata !DIExpression()), !dbg !17
+  ;; DW_ATE_signed
+  call void @llvm.dbg.value(metadata i32 42, metadata !25, metadata !DIExpression()), !dbg !17
+  ret void, !dbg !17
+}
+
+declare void @llvm.dbg.value(metadata, metadata, metadata)
+declare void @llvm.dbg.declare(metadata, metadata, metadata)
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3}
+!llvm.ident = !{!9}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 17.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "test.c", directory: "/")
+!2 = !{i32 7, !"Dwarf Version", i32 5}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!9 = !{!"clang version 17.0.0"}
+!10 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 2, type: !11, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13)
+!11 = !DISubroutineType(types: !12)
+!12 = !{null}
+!13 = !{!14}
+!14 = !DILocalVariable(name: "r1", scope: !10, file: !1, line: 3, type: !15)
+!15 = !DIBasicType(name: "complex", size: 128, encoding: DW_ATE_complex_float)
+!17 = !DILocation(line: 0, scope: !10)
+!20 = !DILocalVariable(name: "a", scope: !10, file: !1, line: 3, type: !21)
+!21 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)
+!22 = !DILocalVariable(name: "MAX", line: 29, scope: !10, file: !1, type: !23)
+!23 = !DIDerivedType(tag: DW_TAG_typedef, name: "ti_int", line: 78, file: !1, scope: !1, baseType: !24)
+!24 = !DIBasicType(tag: DW_TAG_base_type, size: 128, align: 128, encoding: DW_ATE_signed)
+!25 = !DILocalVariable(name: "i", line: 2, scope: !10, file: !1, type: !26)
+!26 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)

diff  --git a/llvm/test/DebugInfo/X86/dbg-const-int.ll b/llvm/test/DebugInfo/X86/dbg-const-int.ll
deleted file mode 100644
index b477a6f56be1c..0000000000000
--- a/llvm/test/DebugInfo/X86/dbg-const-int.ll
+++ /dev/null
@@ -1,38 +0,0 @@
-; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %s \
-; RUN:    | llvm-dwarfdump -v -debug-info - | FileCheck %s
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
-target triple = "x86_64-apple-macosx10.6.7"
-; Radar 9511391
-
-; CHECK: DW_TAG_variable
-; CHECK-NOT: DW_TAG
-; CHECK:   DW_AT_const_value [DW_FORM_sdata]   (42)
-; CHECK-NOT: DW_TAG
-; CHECK:   DW_AT_name {{.*}} "i"
-
-define i32 @foo() nounwind uwtable readnone optsize ssp !dbg !1 {
-entry:
-  tail call void @llvm.dbg.value(metadata i32 42, metadata !6, metadata !DIExpression()), !dbg !9
-  ret i32 42, !dbg !10
-}
-
-declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!15}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.0 (trunk 132191)", isOptimized: true, emissionKind: FullDebug, file: !13, enums: !14, retainedTypes: !14, imports:  null)
-!1 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, file: !13, scope: !2, type: !3, retainedNodes: !12)
-!2 = !DIFile(filename: "a.c", directory: "/private/tmp")
-!3 = !DISubroutineType(types: !4)
-!4 = !{!5}
-!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!6 = !DILocalVariable(name: "i", line: 2, scope: !7, file: !2, type: !5)
-!7 = distinct !DILexicalBlock(line: 1, column: 11, file: !13, scope: !1)
-!8 = !{i32 42}
-!9 = !DILocation(line: 2, column: 12, scope: !7)
-!10 = !DILocation(line: 3, column: 2, scope: !7)
-!12 = !{!6}
-!13 = !DIFile(filename: "a.c", directory: "/private/tmp")
-!14 = !{}
-!15 = !{i32 1, !"Debug Info Version", i32 3}

diff  --git a/llvm/test/DebugInfo/X86/dbg-i128-const.ll b/llvm/test/DebugInfo/X86/dbg-i128-const.ll
deleted file mode 100644
index 461daa9d459ab..0000000000000
--- a/llvm/test/DebugInfo/X86/dbg-i128-const.ll
+++ /dev/null
@@ -1,34 +0,0 @@
-; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s
-
-; CHECK: .section        .debug_info
-; CHECK: DW_AT_const_value
-; CHECK-NEXT: 42
-
-define i128 @__foo(i128 %a, i128 %b) nounwind !dbg !3 {
-entry:
-  tail call void @llvm.dbg.value(metadata i128 42 , metadata !1, metadata !DIExpression()), !dbg !11
-  %add = add i128 %a, %b, !dbg !11
-  ret i128 %add, !dbg !11
-}
-
-declare void @llvm.dbg.value(metadata, metadata, metadata) nounwind readnone
-
-!llvm.dbg.cu = !{!5}
-!llvm.module.flags = !{!16}
-
-!0 = !{i128 42 }
-!1 = !DILocalVariable(name: "MAX", line: 29, scope: !2, file: !4, type: !8)
-!2 = distinct !DILexicalBlock(line: 26, column: 0, file: !13, scope: !3)
-!3 = distinct !DISubprogram(name: "__foo", linkageName: "__foo", line: 26, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !5, scopeLine: 26, file: !13, scope: !4, type: !6)
-!4 = !DIFile(filename: "foo.c", directory: "/tmp")
-!5 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "clang", isOptimized: true, emissionKind: FullDebug, file: !13, enums: !15, retainedTypes: !15, imports:  null)
-!6 = !DISubroutineType(types: !7)
-!7 = !{!8, !8, !8}
-!8 = !DIDerivedType(tag: DW_TAG_typedef, name: "ti_int", line: 78, file: !14, scope: !4, baseType: !10)
-!9 = !DIFile(filename: "myint.h", directory: "/tmp")
-!10 = !DIBasicType(tag: DW_TAG_base_type, size: 128, align: 128, encoding: DW_ATE_signed)
-!11 = !DILocation(line: 29, scope: !2)
-!13 = !DIFile(filename: "foo.c", directory: "/tmp")
-!14 = !DIFile(filename: "myint.h", directory: "/tmp")
-!15 = !{}
-!16 = !{i32 1, !"Debug Info Version", i32 3}

diff  --git a/llvm/test/DebugInfo/X86/float_const.ll b/llvm/test/DebugInfo/X86/float_const.ll
deleted file mode 100644
index 5b323720003b6..0000000000000
--- a/llvm/test/DebugInfo/X86/float_const.ll
+++ /dev/null
@@ -1,54 +0,0 @@
-; RUN: llc < %s -filetype=obj | llvm-dwarfdump -v -debug-info - | FileCheck %s
-; from (at -Os):
-; void foo() {
-;   float a = 3.14;
-;   *(int *)&a = 0;
-; }
-target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
-target triple = "x86_64-apple-macosx10.10.0"
-
-; Function Attrs: nounwind optsize readnone uwtable
-define void @foo() #0 !dbg !7 {
-entry:
-  tail call void @llvm.dbg.declare(metadata ptr undef, metadata !13, metadata !19), !dbg !20
-  tail call void @llvm.dbg.value(metadata i32 1078523331, metadata !13, metadata !19), !dbg !20
-  tail call void @llvm.dbg.value(metadata i32 0, metadata !13, metadata !19), !dbg !20
-; CHECK:  DW_AT_const_value [DW_FORM_sdata]    (0)
-; CHECK-NEXT: DW_AT_name {{.*}}"a"
-  ret void, !dbg !21
-}
-
-; Function Attrs: nounwind readnone
-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-
-; Function Attrs: nounwind readnone
-declare void @llvm.dbg.value(metadata, metadata, metadata) #1
-
-attributes #0 = { nounwind optsize readnone uwtable }
-attributes #1 = { nounwind readnone }
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!15, !16, !17}
-!llvm.ident = !{!18}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.7.0 (trunk 227686)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !3, globals: !2, imports: !2)
-!1 = !DIFile(filename: "foo.c", directory: "")
-!2 = !{}
-!3 = !{!4}
-!4 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !5)
-!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!7 = distinct !DISubprogram(name: "foo", line: 1, isLocal: false, isDefinition: true, isOptimized: true, unit: !0, scopeLine: 1, file: !8, scope: !9, type: !10, retainedNodes: !12)
-!8 = !DIFile(filename: "foo.c", directory: "")
-!9 = !DIFile(filename: "foo.c", directory: "")
-!10 = !DISubroutineType(types: !11)
-!11 = !{null}
-!12 = !{!13}
-!13 = !DILocalVariable(name: "a", line: 2, scope: !7, file: !9, type: !14)
-!14 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)
-!15 = !{i32 2, !"Dwarf Version", i32 2}
-!16 = !{i32 2, !"Debug Info Version", i32 3}
-!17 = !{i32 1, !"PIC Level", i32 2}
-!18 = !{!"clang version 3.7.0 (trunk 227686)"}
-!19 = !DIExpression()
-!20 = !DILocation(line: 2, column: 9, scope: !7)
-!21 = !DILocation(line: 4, column: 1, scope: !7)


        


More information about the llvm-commits mailing list