@@ -5,9 +5,16 @@ declare void @foo(i32)
55define void @test1 (i32 noundef %gid ) !dbg !3 {
66entry:
77 ;
8- ; verify that debug info exists for "xyz" variable
8+ ; Equivalent of code:
9+ ; extern void foo(int);
10+ ; void test_kernel_bool(int a) {
11+ ; bool xyz = a == 0;
12+ ; foo(xyz);
13+ ; }
914 ;
10- ; CHECK-LABEL: DW_TAG_variable
15+ ; Verify that debug info exists for "xyz" variable
16+ ;
17+ ; CHECK: DW_TAG_variable
1118 ; CHECK: .b8 120 // DW_AT_name
1219 ; CHECK-NEXT: .b8 121
1320 ; CHECK-NEXT: .b8 122
@@ -24,6 +31,35 @@ entry:
2431 ret void
2532}
2633
34+ define void @test2 (i32 noundef %gid ) !dbg !14 {
35+ entry:
36+ ;
37+ ; Equivalent of code:
38+ ; extern void foo(int);
39+ ; void test_kernel_bool(int a) {
40+ ; unsigned char abc = a == 0;
41+ ; foo(abc);
42+ ; }
43+ ;
44+ ; Verify that debug info exists for "abc" variable
45+ ;
46+ ; CHECK: DW_TAG_variable
47+ ; CHECK: .b8 97 // DW_AT_name
48+ ; CHECK-NEXT: .b8 98
49+ ; CHECK-NEXT: .b8 99
50+ ; CHECK-NEXT: .b8 0
51+ ; CHECK-NEXT: .b8 1 // DW_AT_decl_file
52+ ; CHECK-NEXT: .b8 11 // DW_AT_decl_line
53+ ;
54+ %cmp = icmp eq i32 %gid , 0 , !dbg !17
55+ %conv = zext i1 %cmp to i32 , !dbg !17
56+ %conv1 = trunc i32 %conv to i8 , !dbg !17
57+ #dbg_value(i8 %conv1 , !16 , !DIExpression (), !18 )
58+ %conv3 = zext i8 %conv1 to i32
59+ call void @foo (i32 %conv3 )
60+ ret void
61+ }
62+
2763!llvm.dbg.cu = !{!0 }
2864!llvm.module.flags = !{!2 }
2965
4177!11 = !DIBasicType (name: "bool" , size: 8 , encoding: DW_ATE_boolean)
4278!12 = !DILocation (line: 1 , column: 3 , scope: !9 )
4379!13 = !DILocation (line: 2 , scope: !9 )
80+ !14 = distinct !DISubprogram (name: "test2" , linkageName: "_test2i" , scope: !1 , file: !1 , line: 10 , type: !4 , scopeLine: 10 , unit: !0 , retainedNodes: !8 )
81+ !15 = distinct !DILexicalBlock (scope: !14 , file: !1 , line: 10 , column: 30 )
82+ !16 = !DILocalVariable (name: "abc" , scope: !15 , file: !1 , line: 11 , type: !11 )
83+ !17 = !DILocation (line: 11 , column: 3 , scope: !15 )
84+ !18 = !DILocation (line: 12 , scope: !15 )
0 commit comments