1; RUN: llc %s -o - | FileCheck %s 2; RUN: llc --try-experimental-debuginfo-iterators %s -o - | FileCheck %s 3 4;; Check single location variables of various types with a constant value are 5;; emitted with a DW_AT_const_value attribute. 6 7;; DW_ATE_complex_float 8;; Modified from C source input: 9;; #include <complex.h> 10;; void f() { double complex r1; } 11; CHECK: .Ldebug_info_start0: 12; CHECK: .byte [[#]] # Abbrev {{.*}} DW_TAG_variable 13; CHECK-NEXT: .byte 0 # DW_AT_const_value 14; CHECK-NEXT: .byte [[r1_str_idx:[0-9]+]] # DW_AT_name 15 16;; DW_ATE_float 17;; from (at -Os): 18;; void foo() { 19;; float a = 3.14; 20;; *(int *)&a = 0; 21;; } 22; CHECK: .byte [[#]] # Abbrev {{.*}} DW_TAG_variable 23; CHECK-NEXT: .byte 0 # DW_AT_const_value 24; CHECK-NEXT: .byte [[a_str_idx:[0-9]+]] # DW_AT_name 25 26;; DW_ATE_signed (i128) 27; CHECK: .byte [[#]] # Abbrev {{.*}} DW_TAG_variable 28; CHECK-NEXT: .byte 16 # DW_AT_const_value 29; CHECK-NEXT: .byte 42 30; CHECK-COUNT-15: .byte 0 31; CHECK-NEXT: .byte [[MAX_str_idx:[0-9]+]] # DW_AT_name 32 33;; DW_ATE_signed (i32) 34; CHECK: .byte [[#]] # Abbrev {{.*}} DW_TAG_variable 35; CHECK-NEXT: .byte 42 # DW_AT_const_value 36; CHECK-NEXT: .byte [[i_str_idx:[0-9]+]] # DW_AT_name 37 38; CHECK: .Linfo_string[[r1_str_idx]]: 39; CHECK-NEXT: .asciz "r1" 40; CHECK: .Linfo_string[[a_str_idx]]: 41; CHECK-NEXT: .asciz "a" 42; CHECK: .Linfo_string[[MAX_str_idx]]: 43; CHECK-NEXT: .asciz "MAX" 44; CHECK: .Linfo_string[[i_str_idx]]: 45; CHECK-NEXT: .asciz "i" 46 47target triple = "x86_64-unknown-linux-gnu" 48 49define dso_local void @f() local_unnamed_addr !dbg !10 { 50entry: 51 ;; DW_ATE_complex_float 52 call void @llvm.dbg.value(metadata i8 0, metadata !14, metadata !DIExpression()), !dbg !17 53 ;; DW_ATE_float 54 call void @llvm.dbg.declare(metadata ptr undef, metadata !20, metadata !DIExpression()), !dbg !17 55 call void @llvm.dbg.value(metadata i32 1078523331, metadata !20, metadata !DIExpression()), !dbg !17 56 call void @llvm.dbg.value(metadata i32 0, metadata !20, metadata !DIExpression()), !dbg !17 57 ;; DW_ATE_signed 58 call void @llvm.dbg.value(metadata i128 42 , metadata !22, metadata !DIExpression()), !dbg !17 59 ;; DW_ATE_signed 60 call void @llvm.dbg.value(metadata i32 42, metadata !25, metadata !DIExpression()), !dbg !17 61 ret void, !dbg !17 62} 63 64declare void @llvm.dbg.value(metadata, metadata, metadata) 65declare void @llvm.dbg.declare(metadata, metadata, metadata) 66 67!llvm.dbg.cu = !{!0} 68!llvm.module.flags = !{!2, !3} 69!llvm.ident = !{!9} 70 71!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) 72!1 = !DIFile(filename: "test.c", directory: "/") 73!2 = !{i32 7, !"Dwarf Version", i32 5} 74!3 = !{i32 2, !"Debug Info Version", i32 3} 75!9 = !{!"clang version 17.0.0"} 76!10 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 2, type: !11, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !13) 77!11 = !DISubroutineType(types: !12) 78!12 = !{null} 79!13 = !{!14} 80!14 = !DILocalVariable(name: "r1", scope: !10, file: !1, line: 3, type: !15) 81!15 = !DIBasicType(name: "complex", size: 128, encoding: DW_ATE_complex_float) 82!17 = !DILocation(line: 0, scope: !10) 83!20 = !DILocalVariable(name: "a", scope: !10, file: !1, line: 3, type: !21) 84!21 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float) 85!22 = !DILocalVariable(name: "MAX", line: 29, scope: !10, file: !1, type: !23) 86!23 = !DIDerivedType(tag: DW_TAG_typedef, name: "ti_int", line: 78, file: !1, scope: !1, baseType: !24) 87!24 = !DIBasicType(tag: DW_TAG_base_type, size: 128, align: 128, encoding: DW_ATE_signed) 88!25 = !DILocalVariable(name: "i", line: 2, scope: !10, file: !1, type: !26) 89!26 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 90