File: selective-function-control-from-file-typed-pointers.ll

package info (click to toggle)
intel-graphics-compiler2 2.16.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 106,644 kB
  • sloc: cpp: 805,640; lisp: 287,672; ansic: 16,414; python: 3,952; yacc: 2,588; lex: 1,666; pascal: 313; sh: 186; makefile: 35
file content (130 lines) | stat: -rw-r--r-- 4,340 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2024 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; REQUIRES: llvm-14-plus, regkeys
; RUN: split-file %s %t
; RUN: igc_opt --typed-pointers --igc-process-func-attributes -S -regkey FunctionControl=3,SelectiveFunctionControl=1,PrintStackCallDebugInfo=1,SelectiveFunctionControlFile=%t/sfc1.ll < %t/test.ll | FileCheck %s --check-prefixes=CHECK-SFC1
; RUN: igc_opt --typed-pointers --igc-process-func-attributes -S -regkey FunctionControl=3,SelectiveFunctionControl=1,PrintStackCallDebugInfo=1,SelectiveFunctionControlFile=%t/sfc2.ll < %t/test.ll | FileCheck %s --check-prefixes=CHECK-SFC2
; RUN: igc_opt --typed-pointers --igc-process-func-attributes -S -regkey FunctionControl=3,SelectiveFunctionControl=1,PrintStackCallDebugInfo=1,SelectiveFunctionControlFile=%t/sfc3.ll < %t/test.ll | FileCheck %s --check-prefixes=CHECK-SFC3
; ------------------------------------------------

; Test checks function control setting from custom file

;--- sfc1.ll
FLAG_FCALL_DEFAULT:
foo1
foo2
foo3
declared_foo

;--- sfc2.ll
FLAG_FCALL_FORCE_INLINE:
foo1
FLAG_FCALL_FORCE_SUBROUTINE:
foo2
FLAG_FCALL_FORCE_STACKCALL:
foo3
FLAG_FCALL_FORCE_INDIRECTCALL:
declared_foo

;--- sfc3.ll
foo1
FLAG_FCALL_FORCE_INLINE:
FLAG_FCALL_FORCE_SUBROUTINE:
foo2
FLAG_FCALL_FORCE_STACKCALL:
foo3
//FLAG_FCALL_FORCE_INDIRECTCALL: comment is ignored
declared_foo

;--- test.ll
define spir_func i32 @foo1(i32* %src) #0 {
; CHECK-SFC1-LABEL: define internal spir_func i32 @foo1(
; CHECK-SFC1-SAME: i32* [[SRC:%.*]]) #[[ATTR0:[0-9]+]] {
;
; CHECK-SFC2-LABEL: define internal spir_func i32 @foo1(
; CHECK-SFC2-SAME: i32* [[SRC:%.*]]) #[[ATTR0:[0-9]+]] {
;
; CHECK-SFC3-LABEL: define internal spir_func i32 @foo1(
; CHECK-SFC3-SAME: i32* [[SRC:%.*]]) #[[ATTR0:[0-9]+]] {
;
  %1 = load i32, i32* %src
  %2 = add i32 %1, 144
  ret i32 %2
}

define spir_func i32 @foo2(i32* %src) #1 {
; CHECK-SFC1-LABEL: define internal spir_func i32 @foo2(
; CHECK-SFC1-SAME: i32* [[SRC:%.*]]) #[[ATTR1:[0-9]+]] {
;
; CHECK-SFC2-LABEL: define internal spir_func i32 @foo2(
; CHECK-SFC2-SAME: i32* [[SRC:%.*]]) #[[ATTR1:[0-9]+]] {
;
; CHECK-SFC3-LABEL: define internal spir_func i32 @foo2(
; CHECK-SFC3-SAME: i32* [[SRC:%.*]]) #[[ATTR1:[0-9]+]] {
;
  %1 = load i32, i32* %src
  %2 = mul i32 %1, 13
  ret i32 %2
}

define spir_func i32 @foo3(i32* %src) #0 {
; CHECK-SFC1-LABEL: define internal spir_func i32 @foo3(
; CHECK-SFC1-SAME: i32* [[SRC:%.*]]) #[[ATTR0]] {
;
; CHECK-SFC2-LABEL: define internal spir_func i32 @foo3(
; CHECK-SFC2-SAME: i32* [[SRC:%.*]]) #[[ATTR2:[0-9]+]] {
;
; CHECK-SFC3-LABEL: define internal spir_func i32 @foo3(
; CHECK-SFC3-SAME: i32* [[SRC:%.*]]) #[[ATTR0]] {
;
  %1 = load i32, i32* %src
  %2 = mul i32 %1, 13
  ret i32 %2
}

define spir_kernel void @test_kernel(i32* %a) #0 {
  %1 = call i32 @foo1(i32* %a)
  %2 = call i32 @foo2(i32* %a)
  %3 = call i32 @foo3(i32* %a)
  %4 = mul i32 %1, %2
  %5 = add i32 %4, %3
  call void @declared_foo(i32 %5)
  ret void
}

declare spir_func void @declared_foo(i32)
; CHECK-SFC1-LABEL: declare spir_func void @declared_foo(
; CHECK-SFC1-SAME: i32) #[[ATTR2:[0-9]+]]

; CHECK-SFC2-LABEL: declare spir_func void @declared_foo(
; CHECK-SFC2-SAME: i32) #[[ATTR3:[0-9]+]]

; CHECK-SFC3-LABEL: declare spir_func void @declared_foo(
; CHECK-SFC3-SAME: i32) #[[ATTR2:[0-9]+]]

attributes #0 = { noinline optnone }
attributes #1 = { alwaysinline }

!igc.functions = !{!1}
!1 = !{void (i32*)* @test_kernel, !2}
!2 = !{!3}
!3 = !{!"function_type", i32 0}

; CHECK-SFC1: attributes #[[ATTR0]] = { noinline optnone "visaStackCall" }
; CHECK-SFC1: attributes #[[ATTR1]] = { noinline "visaStackCall" }
; CHECK-SFC1: attributes #[[ATTR2]] = { "referenced-indirectly" "visaStackCall" }
;.
; CHECK-SFC2: attributes #[[ATTR0]] = { alwaysinline }
; CHECK-SFC2: attributes #[[ATTR1]] = { noinline }
; CHECK-SFC2: attributes #[[ATTR2]] = { noinline optnone "visaStackCall" }
; CHECK-SFC2: attributes #[[ATTR3]] = { noinline "referenced-indirectly" "visaStackCall" }
;.
; CHECK-SFC3: attributes #[[ATTR0]] = { noinline optnone "visaStackCall" }
; CHECK-SFC3: attributes #[[ATTR1]] = { noinline }
; CHECK-SFC3: attributes #[[ATTR2]] = { noinline "visaStackCall" }