Skip to content

Commit 498f6c3

Browse files
Guzewicz, Kacperigcbot
authored andcommitted
Conversion of IGC LITs for opaque pointer support, batch 25
This commit converts part of LITs so that igc_opt uses "--opaque-pointers" option that allows automatic conversion between typed and opaque pointers. Typed version of tests are still kept in separate files.
1 parent 3eab7ff commit 498f6c3

File tree

64 files changed

+3082
-457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3082
-457
lines changed
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
;=========================== begin_copyright_notice ============================
2+
;
3+
; Copyright (C) 2022-2024 Intel Corporation
4+
;
5+
; SPDX-License-Identifier: MIT
6+
;
7+
;============================ end_copyright_notice =============================
8+
;
9+
; RUN: igc_opt -igc-slmconstprop -S < %s | FileCheck %s
10+
; ------------------------------------------------
11+
; SLMConstProp
12+
; ------------------------------------------------
13+
; This test checks that SLMConstProp pass follows
14+
; 'How to Update Debug Info' llvm guideline.
15+
;
16+
; Debug MD for this test was created with debugify pass.
17+
; ------------------------------------------------
18+
19+
; CHECK: define spir_kernel void @test_slmconst{{.*}} !dbg [[SCOPE:![0-9]*]]
20+
; CHECK: entry:
21+
; CHECK: [[VAL1_V:%[A-z0-9]*]] = {{.*}}, !dbg [[VAL1_LOC:![0-9]*]]
22+
; CHECK: void @llvm.dbg.value(metadata i32 [[VAL1_V]], metadata [[VAL1_MD:![0-9]*]], metadata !DIExpression()), !dbg [[VAL1_LOC]]
23+
; CHECK: [[VAL2_V:%[A-z0-9]*]] = {{.*}}, !dbg [[VAL2_LOC:![0-9]*]]
24+
; CHECK: void @llvm.dbg.value(metadata i32 [[VAL2_V]], metadata [[VAL2_MD:![0-9]*]], metadata !DIExpression()), !dbg [[VAL2_LOC]]
25+
; CHECK: [[VAL3_V:%[A-z0-9]*]] = {{.*}}, !dbg [[VAL3_LOC:![0-9]*]]
26+
; CHECK: void @llvm.dbg.value(metadata float addrspace(3)* [[VAL3_V]], metadata [[VAL3_MD:![0-9]*]], metadata !DIExpression()), !dbg [[VAL3_LOC]]
27+
; CHECK: store float 4.0{{.*}}, !dbg [[STORE1_LOC:![0-9]*]]
28+
; CHECK: store float 4.0{{.*}}, !dbg [[STORE2_LOC:![0-9]*]]
29+
; CHECK: store float 4.0{{.*}}, !dbg [[STORE3_LOC:![0-9]*]]
30+
; CHECK: call void @llvm.genx.GenISA.threadgroupbarrier(), !dbg [[CALL_LOC:![0-9]*]]
31+
; CHECK: void @llvm.dbg.value(metadata float 4.0{{.*}}, metadata [[VAL8_MD:![0-9]*]], metadata !DIExpression()), !dbg [[VAL8_LOC:![0-9]*]]
32+
; CHECK: void @llvm.dbg.value(metadata float 4.0{{.*}}, metadata [[VAL9_MD:![0-9]*]], metadata !DIExpression()), !dbg [[VAL9_LOC:![0-9]*]]
33+
34+
define spir_kernel void @test_slmconst(float %a, float* %b) !dbg !9 {
35+
entry:
36+
%0 = call i32 @llvm.genx.GenISA.DCL.SystemValue.i32(i32 17), !dbg !24
37+
call void @llvm.dbg.value(metadata i32 %0, metadata !12, metadata !DIExpression()), !dbg !24
38+
%aa = mul i32 %0, 4, !dbg !25
39+
call void @llvm.dbg.value(metadata i32 %aa, metadata !14, metadata !DIExpression()), !dbg !25
40+
%1 = inttoptr i32 %aa to float addrspace(3)*, !dbg !26
41+
call void @llvm.dbg.value(metadata float addrspace(3)* %1, metadata !15, metadata !DIExpression()), !dbg !26
42+
store float 4.000000e+00, float addrspace(3)* %1, !dbg !27
43+
%2 = add i32 %aa, 4, !dbg !28
44+
call void @llvm.dbg.value(metadata i32 %2, metadata !17, metadata !DIExpression()), !dbg !28
45+
%3 = inttoptr i32 %2 to float addrspace(3)*, !dbg !29
46+
call void @llvm.dbg.value(metadata float addrspace(3)* %3, metadata !18, metadata !DIExpression()), !dbg !29
47+
store float 4.000000e+00, float addrspace(3)* %3, !dbg !30
48+
%4 = add i32 %aa, 8, !dbg !31
49+
call void @llvm.dbg.value(metadata i32 %4, metadata !19, metadata !DIExpression()), !dbg !31
50+
%5 = inttoptr i32 %4 to float addrspace(3)*, !dbg !32
51+
call void @llvm.dbg.value(metadata float addrspace(3)* %5, metadata !20, metadata !DIExpression()), !dbg !32
52+
store float 4.000000e+00, float addrspace(3)* %5, !dbg !33
53+
call void @llvm.genx.GenISA.threadgroupbarrier(), !dbg !34
54+
%load1 = load float, float addrspace(3)* %1, !dbg !35
55+
call void @llvm.dbg.value(metadata float %load1, metadata !21, metadata !DIExpression()), !dbg !35
56+
%load2 = load float, float addrspace(3)* %3, !dbg !36
57+
call void @llvm.dbg.value(metadata float %load2, metadata !22, metadata !DIExpression()), !dbg !36
58+
%add1 = fadd float %load1, %load2, !dbg !37
59+
call void @llvm.dbg.value(metadata float %add1, metadata !23, metadata !DIExpression()), !dbg !37
60+
store float %add1, float* %b, !dbg !38
61+
ret void, !dbg !39
62+
}
63+
64+
; CHECK-DAG: [[FILE:![0-9]*]] = !DIFile(filename: "SLMConstProp.ll", directory: "/")
65+
; CHECK-DAG: [[SCOPE]] = distinct !DISubprogram(name: "test_slmconst", linkageName: "test_slmconst", scope: null, file: [[FILE]], line: 1
66+
; CHECK-DAG: [[VAL1_MD]] = !DILocalVariable(name: "1", scope: [[SCOPE]], file: [[FILE]], line: 1
67+
; CHECK-DAG: [[VAL1_LOC]] = !DILocation(line: 1, column: 1, scope: [[SCOPE]])
68+
; CHECK-DAG: [[VAL2_MD]] = !DILocalVariable(name: "2", scope: [[SCOPE]], file: [[FILE]], line: 2
69+
; CHECK-DAG: [[VAL2_LOC]] = !DILocation(line: 2, column: 1, scope: [[SCOPE]])
70+
; CHECK-DAG: [[VAL3_MD]] = !DILocalVariable(name: "3", scope: [[SCOPE]], file: [[FILE]], line: 3
71+
; CHECK-DAG: [[VAL3_LOC]] = !DILocation(line: 3, column: 1, scope: [[SCOPE]])
72+
; CHECK-DAG: [[STORE1_LOC]] = !DILocation(line: 4, column: 1, scope: [[SCOPE]])
73+
; CHECK-DAG: [[STORE2_LOC]] = !DILocation(line: 7, column: 1, scope: [[SCOPE]])
74+
; CHECK-DAG: [[STORE3_LOC]] = !DILocation(line: 10, column: 1, scope: [[SCOPE]])
75+
; CHECK-DAG: [[CALL_LOC]] = !DILocation(line: 11, column: 1, scope: [[SCOPE]])
76+
; CHECK-DAG: [[VAL8_MD]] = !DILocalVariable(name: "8", scope: [[SCOPE]], file: [[FILE]], line: 12
77+
; CHECK-DAG: [[VAL8_LOC]] = !DILocation(line: 12, column: 1, scope: [[SCOPE]])
78+
; CHECK-DAG: [[VAL9_MD]] = !DILocalVariable(name: "9", scope: [[SCOPE]], file: [[FILE]], line: 13
79+
; CHECK-DAG: [[VAL9_LOC]] = !DILocation(line: 13, column: 1, scope: [[SCOPE]])
80+
81+
declare void @llvm.genx.GenISA.threadgroupbarrier()
82+
83+
declare i32 @llvm.genx.GenISA.DCL.SystemValue.i32(i32)
84+
85+
; Function Attrs: nounwind readnone speculatable
86+
declare void @llvm.dbg.value(metadata, metadata, metadata) #0
87+
88+
attributes #0 = { nounwind readnone speculatable }
89+
90+
!igc.functions = !{!0}
91+
!llvm.dbg.cu = !{!3}
92+
!llvm.debugify = !{!6, !7}
93+
!llvm.module.flags = !{!8}
94+
95+
!0 = !{void (float, float*)* @test_slmconst, !1}
96+
!1 = !{!2}
97+
!2 = !{!"function_type", i32 0}
98+
!3 = distinct !DICompileUnit(language: DW_LANG_C, file: !4, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5)
99+
!4 = !DIFile(filename: "SLMConstProp.ll", directory: "/")
100+
!5 = !{}
101+
!6 = !{i32 16}
102+
!7 = !{i32 10}
103+
!8 = !{i32 2, !"Debug Info Version", i32 3}
104+
!9 = distinct !DISubprogram(name: "test_slmconst", linkageName: "test_slmconst", scope: null, file: !4, line: 1, type: !10, scopeLine: 1, unit: !3, retainedNodes: !11)
105+
!10 = !DISubroutineType(types: !5)
106+
!11 = !{!12, !14, !15, !17, !18, !19, !20, !21, !22, !23}
107+
!12 = !DILocalVariable(name: "1", scope: !9, file: !4, line: 1, type: !13)
108+
!13 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
109+
!14 = !DILocalVariable(name: "2", scope: !9, file: !4, line: 2, type: !13)
110+
!15 = !DILocalVariable(name: "3", scope: !9, file: !4, line: 3, type: !16)
111+
!16 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)
112+
!17 = !DILocalVariable(name: "4", scope: !9, file: !4, line: 5, type: !13)
113+
!18 = !DILocalVariable(name: "5", scope: !9, file: !4, line: 6, type: !16)
114+
!19 = !DILocalVariable(name: "6", scope: !9, file: !4, line: 8, type: !13)
115+
!20 = !DILocalVariable(name: "7", scope: !9, file: !4, line: 9, type: !16)
116+
!21 = !DILocalVariable(name: "8", scope: !9, file: !4, line: 12, type: !13)
117+
!22 = !DILocalVariable(name: "9", scope: !9, file: !4, line: 13, type: !13)
118+
!23 = !DILocalVariable(name: "10", scope: !9, file: !4, line: 14, type: !13)
119+
!24 = !DILocation(line: 1, column: 1, scope: !9)
120+
!25 = !DILocation(line: 2, column: 1, scope: !9)
121+
!26 = !DILocation(line: 3, column: 1, scope: !9)
122+
!27 = !DILocation(line: 4, column: 1, scope: !9)
123+
!28 = !DILocation(line: 5, column: 1, scope: !9)
124+
!29 = !DILocation(line: 6, column: 1, scope: !9)
125+
!30 = !DILocation(line: 7, column: 1, scope: !9)
126+
!31 = !DILocation(line: 8, column: 1, scope: !9)
127+
!32 = !DILocation(line: 9, column: 1, scope: !9)
128+
!33 = !DILocation(line: 10, column: 1, scope: !9)
129+
!34 = !DILocation(line: 11, column: 1, scope: !9)
130+
!35 = !DILocation(line: 12, column: 1, scope: !9)
131+
!36 = !DILocation(line: 13, column: 1, scope: !9)
132+
!37 = !DILocation(line: 14, column: 1, scope: !9)
133+
!38 = !DILocation(line: 15, column: 1, scope: !9)
134+
!39 = !DILocation(line: 16, column: 1, scope: !9)

IGC/Compiler/tests/DebugInfo/SLMConstProp.ll

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
;=========================== begin_copyright_notice ============================
22
;
3-
; Copyright (C) 2022 Intel Corporation
3+
; Copyright (C) 2022-2024 Intel Corporation
44
;
55
; SPDX-License-Identifier: MIT
66
;
77
;============================ end_copyright_notice =============================
88
;
9-
; RUN: igc_opt -igc-slmconstprop -S < %s | FileCheck %s
9+
; REQUIRES: llvm-14-plus
10+
; RUN: igc_opt --opaque-pointers -igc-slmconstprop -S < %s | FileCheck %s
1011
; ------------------------------------------------
1112
; SLMConstProp
1213
; ------------------------------------------------
@@ -23,41 +24,41 @@
2324
; CHECK: [[VAL2_V:%[A-z0-9]*]] = {{.*}}, !dbg [[VAL2_LOC:![0-9]*]]
2425
; CHECK: void @llvm.dbg.value(metadata i32 [[VAL2_V]], metadata [[VAL2_MD:![0-9]*]], metadata !DIExpression()), !dbg [[VAL2_LOC]]
2526
; CHECK: [[VAL3_V:%[A-z0-9]*]] = {{.*}}, !dbg [[VAL3_LOC:![0-9]*]]
26-
; CHECK: void @llvm.dbg.value(metadata float addrspace(3)* [[VAL3_V]], metadata [[VAL3_MD:![0-9]*]], metadata !DIExpression()), !dbg [[VAL3_LOC]]
27+
; CHECK: void @llvm.dbg.value(metadata ptr addrspace(3) [[VAL3_V]], metadata [[VAL3_MD:![0-9]*]], metadata !DIExpression()), !dbg [[VAL3_LOC]]
2728
; CHECK: store float 4.0{{.*}}, !dbg [[STORE1_LOC:![0-9]*]]
2829
; CHECK: store float 4.0{{.*}}, !dbg [[STORE2_LOC:![0-9]*]]
2930
; CHECK: store float 4.0{{.*}}, !dbg [[STORE3_LOC:![0-9]*]]
3031
; CHECK: call void @llvm.genx.GenISA.threadgroupbarrier(), !dbg [[CALL_LOC:![0-9]*]]
3132
; CHECK: void @llvm.dbg.value(metadata float 4.0{{.*}}, metadata [[VAL8_MD:![0-9]*]], metadata !DIExpression()), !dbg [[VAL8_LOC:![0-9]*]]
3233
; CHECK: void @llvm.dbg.value(metadata float 4.0{{.*}}, metadata [[VAL9_MD:![0-9]*]], metadata !DIExpression()), !dbg [[VAL9_LOC:![0-9]*]]
3334

34-
define spir_kernel void @test_slmconst(float %a, float* %b) !dbg !9 {
35+
define spir_kernel void @test_slmconst(float %a, ptr %b) !dbg !9 {
3536
entry:
3637
%0 = call i32 @llvm.genx.GenISA.DCL.SystemValue.i32(i32 17), !dbg !24
3738
call void @llvm.dbg.value(metadata i32 %0, metadata !12, metadata !DIExpression()), !dbg !24
3839
%aa = mul i32 %0, 4, !dbg !25
3940
call void @llvm.dbg.value(metadata i32 %aa, metadata !14, metadata !DIExpression()), !dbg !25
40-
%1 = inttoptr i32 %aa to float addrspace(3)*, !dbg !26
41-
call void @llvm.dbg.value(metadata float addrspace(3)* %1, metadata !15, metadata !DIExpression()), !dbg !26
42-
store float 4.000000e+00, float addrspace(3)* %1, !dbg !27
41+
%1 = inttoptr i32 %aa to ptr addrspace(3), !dbg !26
42+
call void @llvm.dbg.value(metadata ptr addrspace(3) %1, metadata !15, metadata !DIExpression()), !dbg !26
43+
store float 4.000000e+00, ptr addrspace(3) %1, !dbg !27
4344
%2 = add i32 %aa, 4, !dbg !28
4445
call void @llvm.dbg.value(metadata i32 %2, metadata !17, metadata !DIExpression()), !dbg !28
45-
%3 = inttoptr i32 %2 to float addrspace(3)*, !dbg !29
46-
call void @llvm.dbg.value(metadata float addrspace(3)* %3, metadata !18, metadata !DIExpression()), !dbg !29
47-
store float 4.000000e+00, float addrspace(3)* %3, !dbg !30
46+
%3 = inttoptr i32 %2 to ptr addrspace(3), !dbg !29
47+
call void @llvm.dbg.value(metadata ptr addrspace(3) %3, metadata !18, metadata !DIExpression()), !dbg !29
48+
store float 4.000000e+00, ptr addrspace(3) %3, !dbg !30
4849
%4 = add i32 %aa, 8, !dbg !31
4950
call void @llvm.dbg.value(metadata i32 %4, metadata !19, metadata !DIExpression()), !dbg !31
50-
%5 = inttoptr i32 %4 to float addrspace(3)*, !dbg !32
51-
call void @llvm.dbg.value(metadata float addrspace(3)* %5, metadata !20, metadata !DIExpression()), !dbg !32
52-
store float 4.000000e+00, float addrspace(3)* %5, !dbg !33
51+
%5 = inttoptr i32 %4 to ptr addrspace(3), !dbg !32
52+
call void @llvm.dbg.value(metadata ptr addrspace(3) %5, metadata !20, metadata !DIExpression()), !dbg !32
53+
store float 4.000000e+00, ptr addrspace(3) %5, !dbg !33
5354
call void @llvm.genx.GenISA.threadgroupbarrier(), !dbg !34
54-
%load1 = load float, float addrspace(3)* %1, !dbg !35
55+
%load1 = load float, ptr addrspace(3) %1, !dbg !35
5556
call void @llvm.dbg.value(metadata float %load1, metadata !21, metadata !DIExpression()), !dbg !35
56-
%load2 = load float, float addrspace(3)* %3, !dbg !36
57+
%load2 = load float, ptr addrspace(3) %3, !dbg !36
5758
call void @llvm.dbg.value(metadata float %load2, metadata !22, metadata !DIExpression()), !dbg !36
5859
%add1 = fadd float %load1, %load2, !dbg !37
5960
call void @llvm.dbg.value(metadata float %add1, metadata !23, metadata !DIExpression()), !dbg !37
60-
store float %add1, float* %b, !dbg !38
61+
store float %add1, ptr %b, !dbg !38
6162
ret void, !dbg !39
6263
}
6364

@@ -92,7 +93,7 @@ attributes #0 = { nounwind readnone speculatable }
9293
!llvm.debugify = !{!6, !7}
9394
!llvm.module.flags = !{!8}
9495

95-
!0 = !{void (float, float*)* @test_slmconst, !1}
96+
!0 = !{ptr @test_slmconst, !1}
9697
!1 = !{!2}
9798
!2 = !{!"function_type", i32 0}
9899
!3 = distinct !DICompileUnit(language: DW_LANG_C, file: !4, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !5)

0 commit comments

Comments
 (0)