Skip to content

Commit 9fd3398

Browse files
krzysiek358igcbot
authored andcommitted
Create tests for GASResolving
Introduce new and move old tests for GASResolving pass.
1 parent d61013c commit 9fd3398

21 files changed

+483
-0
lines changed

IGC/Compiler/tests/DebugInfo/GASResolve/basic-typed-pointers.ll renamed to IGC/Compiler/tests/DebugInfo/GASResolving/basic-typed-pointers.ll

File renamed without changes.
File renamed without changes.

IGC/Compiler/tests/DebugInfo/GASResolve/ib_calls-typed-pointers.ll renamed to IGC/Compiler/tests/DebugInfo/GASResolving/ib_calls-typed-pointers.ll

File renamed without changes.
File renamed without changes.

IGC/Compiler/tests/DebugInfo/GASResolve/memfunc-typed-pointers.ll renamed to IGC/Compiler/tests/DebugInfo/GASResolving/memfunc-typed-pointers.ll

File renamed without changes.
File renamed without changes.

IGC/Compiler/tests/DebugInfo/GASResolve/selectphi-typed-pointers.ll renamed to IGC/Compiler/tests/DebugInfo/GASResolving/selectphi-typed-pointers.ll

File renamed without changes.
File renamed without changes.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
;=========================== begin_copyright_notice ============================
3+
;
4+
; Copyright (C) 2024 Intel Corporation
5+
;
6+
; SPDX-License-Identifier: MIT
7+
;
8+
;============================ end_copyright_notice =============================
9+
10+
; RUN: igc_opt -debugify --igc-gas-resolve -S < %s | FileCheck %s
11+
12+
; We use "-debugify" in order to have some metadata in addrspacecast instruction.
13+
; addrspacecast instructions in both directions should have a metadata.
14+
15+
%st = type {i32 addrspace(4)*}
16+
17+
define i32 addrspace(4)* @should_add_addrspacecast_with_metadata(%st addrspace(1)* %src) {
18+
; CHECK-LABEL: define i32 addrspace(4)* @should_add_addrspacecast_with_metadata(
19+
; CHECK-SAME: [[ST:%.*]] addrspace(1)* [[SRC:%.*]]) !dbg [[DBG8:![0-9]+]] {
20+
; CHECK-NEXT: [[TMP1:%.*]] = inttoptr i32 13 to i32 addrspace(2)*, !dbg [[DBG18:![0-9]+]]
21+
; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 addrspace(2)* [[TMP1]], metadata [[META12:![0-9]+]], metadata !DIExpression()), !dbg [[DBG18]]
22+
; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 addrspace(2)* [[TMP1]], metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG19:![0-9]+]]
23+
; CHECK-NEXT: [[TMP2:%.*]] = getelementptr [[ST]], [[ST]] addrspace(1)* [[SRC]], i32 0, i32 0, !dbg [[DBG20:![0-9]+]]
24+
; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 addrspace(4)* addrspace(1)* [[TMP2]], metadata [[META15:![0-9]+]], metadata !DIExpression()), !dbg [[DBG20]]
25+
; CHECK-NEXT: [[POINTER_VALUE:%.*]] = load i32 addrspace(4)*, i32 addrspace(4)* addrspace(1)* [[TMP2]], align 8, !dbg [[DBG21:![0-9]+]]
26+
; CHECK-NEXT: [[TMP3:%.*]] = addrspacecast i32 addrspace(4)* [[POINTER_VALUE]] to i32 addrspace(1)*, !dbg [[DBG21]]
27+
; CHECK-NEXT: [[TMP4:%.*]] = addrspacecast i32 addrspace(1)* [[TMP3]] to i32 addrspace(4)*, !dbg [[DBG21]]
28+
; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 addrspace(4)* [[POINTER_VALUE]], metadata [[META16:![0-9]+]], metadata !DIExpression()), !dbg [[DBG21]]
29+
; CHECK-NEXT: [[POINTER_VALUE2:%.*]] = addrspacecast i32 addrspace(4)* [[TMP4]] to i32 addrspace(2)*, !dbg [[DBG22:![0-9]+]]
30+
; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 addrspace(2)* [[POINTER_VALUE2]], metadata [[META17:![0-9]+]], metadata !DIExpression()), !dbg [[DBG22]]
31+
; CHECK-NEXT: store i32 13, i32 addrspace(1)* [[TMP3]], align 4, !dbg [[DBG23:![0-9]+]]
32+
; CHECK-NEXT: store i32 14, i32 addrspace(2)* [[POINTER_VALUE2]], align 4, !dbg [[DBG24:![0-9]+]]
33+
; CHECK-NEXT: ret i32 addrspace(4)* [[TMP4]], !dbg [[DBG25:![0-9]+]]
34+
;
35+
%1 = inttoptr i32 13 to i32 addrspace(2)*
36+
%2 = addrspacecast i32 addrspace(2)* %1 to i32 addrspace(4)*
37+
%3 = getelementptr %st, %st addrspace(1)* %src, i32 0, i32 0
38+
%pointer_value = load i32 addrspace(4)*, i32 addrspace(4)* addrspace(1)* %3
39+
%pointer_value2 = addrspacecast i32 addrspace(4)* %pointer_value to i32 addrspace(2)*
40+
store i32 13, i32 addrspace(4)* %pointer_value
41+
store i32 14, i32 addrspace(2)* %pointer_value2
42+
ret i32 addrspace(4)* %pointer_value
43+
}
44+
45+
!igc.functions = !{!0}
46+
!0 = !{i32 addrspace(4)* (%st addrspace(1)*)* @should_add_addrspacecast_with_metadata, !1}
47+
!1 = !{!2}
48+
!2 = !{!"function_type", i32 0}
49+
;.
50+
; CHECK: [[META3:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C, file: [[META4:![0-9]+]], producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
51+
; CHECK: [[META4]] = !DIFile(filename: "<stdin>", directory: {{.*}})
52+
; CHECK: [[DBG8]] = distinct !DISubprogram(name: "should_add_addrspacecast_with_metadata", linkageName: "should_add_addrspacecast_with_metadata", scope: null, file: [[META4]], line: 1, type: [[META9:![0-9]+]], scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META3]], retainedNodes: [[META11:![0-9]+]])
53+
; CHECK: [[META9]] = !DISubroutineType(types: [[META10:![0-9]+]])
54+
; CHECK: [[META10]] = !{}
55+
; CHECK: [[META11]] = !{[[META12]], [[META14]], [[META15]], [[META16]], [[META17]]}
56+
; CHECK: [[META12]] = !DILocalVariable(name: "1", scope: [[DBG8]], file: [[META4]], line: 1, type: [[META13:![0-9]+]])
57+
; CHECK: [[META13]] = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)
58+
; CHECK: [[META14]] = !DILocalVariable(name: "2", scope: [[DBG8]], file: [[META4]], line: 2, type: [[META13]])
59+
; CHECK: [[META15]] = !DILocalVariable(name: "3", scope: [[DBG8]], file: [[META4]], line: 3, type: [[META13]])
60+
; CHECK: [[META16]] = !DILocalVariable(name: "4", scope: [[DBG8]], file: [[META4]], line: 4, type: [[META13]])
61+
; CHECK: [[META17]] = !DILocalVariable(name: "5", scope: [[DBG8]], file: [[META4]], line: 5, type: [[META13]])
62+
; CHECK: [[DBG18]] = !DILocation(line: 1, column: 1, scope: [[DBG8]])
63+
; CHECK: [[DBG19]] = !DILocation(line: 2, column: 1, scope: [[DBG8]])
64+
; CHECK: [[DBG20]] = !DILocation(line: 3, column: 1, scope: [[DBG8]])
65+
; CHECK: [[DBG21]] = !DILocation(line: 4, column: 1, scope: [[DBG8]])
66+
; CHECK: [[DBG22]] = !DILocation(line: 5, column: 1, scope: [[DBG8]])
67+
; CHECK: [[DBG23]] = !DILocation(line: 6, column: 1, scope: [[DBG8]])
68+
; CHECK: [[DBG24]] = !DILocation(line: 7, column: 1, scope: [[DBG8]])
69+
; CHECK: [[DBG25]] = !DILocation(line: 8, column: 1, scope: [[DBG8]])
70+
;.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
;=========================== begin_copyright_notice ============================
3+
;
4+
; Copyright (C) 2024 Intel Corporation
5+
;
6+
; SPDX-License-Identifier: MIT
7+
;
8+
;============================ end_copyright_notice =============================
9+
10+
; RUN: igc_opt -debugify --igc-gas-resolve --opaque-pointers -S < %s | FileCheck %s
11+
; REQUIRES: llvm-14-plus, opaque-ptr-fix
12+
13+
%st = type {ptr addrspace(4)}
14+
15+
define ptr addrspace(4) @should_add_addrspacecast_with_metadata(ptr addrspace(1) %src) {
16+
%1 = inttoptr i32 13 to ptr addrspace(2)
17+
%2 = addrspacecast ptr addrspace(2) %1 to ptr addrspace(4)
18+
%3 = getelementptr %st, ptr addrspace(1) %src, i32 0, i32 0
19+
%pointer_value = load ptr addrspace(4), ptr addrspace(1) %3
20+
%pointer_value2 = addrspacecast ptr addrspace(4) %pointer_value to ptr addrspace(2)
21+
store i32 13, ptr addrspace(4) %pointer_value
22+
store i32 14, ptr addrspace(2) %pointer_value2
23+
ret ptr addrspace(4) %pointer_value
24+
}
25+
26+
!igc.functions = !{!0}
27+
!0 = !{ptr addrspace(4) (ptr addrspace(1))* @should_add_addrspacecast_with_metadata, !1}
28+
!1 = !{!2}
29+
!2 = !{!"function_type", i32 0}

0 commit comments

Comments
 (0)