-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Update aspect propagation for virtual functions (#15703)
Spec & design: intel/llvm#10540
- Loading branch information
Showing
5 changed files
with
171 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
llvm/test/SYCLLowerIR/PropagateAspectsUsage/VirtualFunctions/virtual-functions-1.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
; RUN: opt -passes=sycl-propagate-aspects-usage < %s -S | FileCheck %s | ||
|
||
; CHECK: @vfn() #0 !sycl_used_aspects ![[#aspects:]] | ||
define spir_func void @vfn() #0 { | ||
%tmp = alloca double | ||
ret void | ||
} | ||
|
||
; CHECK: @foo() #1 !sycl_used_aspects ![[#aspects]] | ||
define spir_kernel void @foo() #1 { | ||
ret void | ||
} | ||
|
||
; CHECK: ![[#aspects]] = !{i32 6} | ||
|
||
attributes #0 = { "indirectly-callable"="_ZTSv" } | ||
attributes #1 = { "calls-indirectly"="_ZTSv" } | ||
|
||
!sycl_aspects = !{!0} | ||
!0 = !{!"fp64", i32 6} |
36 changes: 36 additions & 0 deletions
36
llvm/test/SYCLLowerIR/PropagateAspectsUsage/VirtualFunctions/virtual-functions-2.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
; RUN: opt -passes=sycl-propagate-aspects-usage < %s -S | FileCheck %s | ||
|
||
%Foo = type { i32 } | ||
%Bar = type { i32 } | ||
|
||
; CHECK: @vfnFoo() #0 !sycl_used_aspects ![[#aspectsFoo:]] | ||
define spir_func void @vfnFoo() #0 { | ||
%tmp = alloca %Foo | ||
ret void | ||
} | ||
|
||
; CHECK: @vfnBar() #1 !sycl_used_aspects ![[#aspectsBar:]] | ||
define spir_func void @vfnBar() #1 { | ||
%tmp = alloca %Bar | ||
ret void | ||
} | ||
|
||
; CHECK: @kernel() #2 !sycl_used_aspects ![[#aspectsKernel:]] | ||
define spir_kernel void @kernel() #2 { | ||
ret void | ||
} | ||
|
||
; CHECK: ![[#aspectsFoo]] = !{i32 1} | ||
; CHECK: ![[#aspectsBar]] = !{i32 2} | ||
; CHECK: ![[#aspectsKernel]] = !{i32 1, i32 2} | ||
|
||
attributes #0 = { "indirectly-callable"="setFoo" } | ||
attributes #1 = { "indirectly-callable"="setBar" } | ||
attributes #2 = { "calls-indirectly"="setFoo,setBar" } | ||
|
||
!sycl_aspects = !{!0} | ||
!0 = !{!"fp64", i32 6} | ||
|
||
!sycl_types_that_use_aspects = !{!1, !2} | ||
!1 = !{!"Foo", i32 1} | ||
!2 = !{!"Bar", i32 2} |
51 changes: 51 additions & 0 deletions
51
llvm/test/SYCLLowerIR/PropagateAspectsUsage/VirtualFunctions/virtual-functions-3.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
; RUN: opt -passes=sycl-propagate-aspects-usage < %s -S | FileCheck %s | ||
|
||
%Foo = type { i32 } | ||
%Bar = type { i32 } | ||
|
||
; CHECK: @vfnFoo() #0 !sycl_used_aspects ![[#aspectsFoo:]] | ||
define spir_func void @vfnFoo() #0 { | ||
call void @subFoo() | ||
ret void | ||
} | ||
|
||
define spir_func void @subFoo() { | ||
%tmp = alloca %Foo | ||
ret void | ||
} | ||
|
||
; CHECK: @vfnBar() #1 !sycl_used_aspects ![[#aspectsBar:]] | ||
define spir_func void @vfnBar() #1 { | ||
call void @subBar() | ||
ret void | ||
} | ||
|
||
define spir_func void @subBar() { | ||
%tmp = alloca %Bar | ||
ret void | ||
} | ||
|
||
; CHECK: @kernelA() #2 !sycl_used_aspects ![[#aspectsFoo]] | ||
define spir_kernel void @kernelA() #2 { | ||
ret void | ||
} | ||
|
||
; CHECK: @kernelB() #3 !sycl_used_aspects ![[#aspectsBar]] | ||
define spir_kernel void @kernelB() #3 { | ||
ret void | ||
} | ||
|
||
; CHECK: ![[#aspectsFoo]] = !{i32 1} | ||
; CHECK: ![[#aspectsBar]] = !{i32 2} | ||
|
||
attributes #0 = { "indirectly-callable"="setFoo" } | ||
attributes #1 = { "indirectly-callable"="setBar" } | ||
attributes #2 = { "calls-indirectly"="setFoo" } | ||
attributes #3 = { "calls-indirectly"="setBar" } | ||
|
||
!sycl_aspects = !{!0} | ||
!0 = !{!"fp64", i32 6} | ||
|
||
!sycl_types_that_use_aspects = !{!1, !2} | ||
!1 = !{!"Foo", i32 1} | ||
!2 = !{!"Bar", i32 2} |
26 changes: 26 additions & 0 deletions
26
llvm/test/SYCLLowerIR/PropagateAspectsUsage/VirtualFunctions/virtual-functions-4.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
; RUN: opt -passes=sycl-propagate-aspects-usage < %s -S | FileCheck %s | ||
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64-G1" | ||
target triple = "spir64-unknown-unknown" | ||
|
||
@vtable = linkonce_odr dso_local unnamed_addr addrspace(1) constant { [3 x ptr addrspace(4)] } { [3 x ptr addrspace(4)] [ptr addrspace(4) null, ptr addrspace(4) null, ptr addrspace(4) addrspacecast (ptr @foo to ptr addrspace(4))] }, align 8 | ||
|
||
; CHECK: @foo() #0 !sycl_used_aspects ![[#aspects:]] | ||
define linkonce_odr spir_func void @foo() #0 { | ||
entry: | ||
%tmp = alloca double | ||
ret void | ||
} | ||
|
||
; CHECK-NOT: @construct({{.*}}){{.*}}!sycl_used_aspects | ||
define weak_odr dso_local spir_kernel void @construct(ptr addrspace(1) noundef align 8 %_arg_StorageAcc) { | ||
entry: | ||
store ptr addrspace(1) getelementptr inbounds inrange(-16, 8) (i8, ptr addrspace(1) @vtable, i64 16), ptr addrspace(1) %_arg_StorageAcc, align 8 | ||
ret void | ||
} | ||
|
||
; CHECK: ![[#aspects]] = !{i32 6} | ||
|
||
attributes #0 = { "indirectly-callable"="set-foo" } | ||
|
||
!sycl_aspects = !{!0} | ||
!0 = !{!"fp64", i32 6} |