brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · 54485b7 Raw
89 lines · plain
1; Test checks that kernels are being split by attached module-id metadata and2; used functions are being moved with kernels that use them.3 4; RUN: llvm-split -split-by-category=module-id -S < %s -o %t5; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-TU0,CHECK6; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-TU1,CHECK7 8; CHECK-TU1-NOT: @GV9; CHECK-TU0: @GV = internal addrspace(1) constant [1 x i32] [i32 42], align 410@GV = internal addrspace(1) constant [1 x i32] [i32 42], align 411 12; CHECK-TU0-NOT: define dso_local spir_kernel void @TU1_kernelA13; CHECK-TU1: define dso_local spir_kernel void @TU1_kernelA14define dso_local spir_kernel void @TU1_kernelA() #0 {15entry:16; CHECK-TU1: call spir_func void @func1_TU1()17  call spir_func void @func1_TU1()18  ret void19}20 21; CHECK-TU0-NOT: define {{.*}} spir_func void @func1_TU1()22; CHECK-TU1: define {{.*}} spir_func void @func1_TU1()23define dso_local spir_func void @func1_TU1() {24entry:25; CHECK-TU1: call spir_func void @func2_TU1()26  call spir_func void @func2_TU1()27  ret void28}29 30; CHECK-TU0-NOT: define {{.*}} spir_func void @func2_TU1()31; CHECK-TU1: define {{.*}} spir_func void @func2_TU1()32define linkonce_odr dso_local spir_func void @func2_TU1() {33entry:34  ret void35}36 37; CHECK-TU0-NOT: define dso_local spir_kernel void @TU1_kernelB()38; CHECK-TU1: define dso_local spir_kernel void @TU1_kernelB()39define dso_local spir_kernel void @TU1_kernelB() #0 {40entry:41; CHECK-TU1: call spir_func void @func3_TU1()42  call spir_func void @func3_TU1()43  ret void44}45 46; CHECK-TU0-NOT: define {{.*}} spir_func void @func3_TU1()47; CHECK-TU1: define {{.*}} spir_func void @func3_TU1()48define dso_local spir_func void @func3_TU1() {49entry:50  ret void51}52 53; CHECK-TU0-TXT: TU0_kernel54; CHECK-TU1-TXT-NOT: TU0_kernel55 56; CHECK-TU0: define dso_local spir_kernel void @TU0_kernel()57; CHECK-TU1-NOT: define dso_local spir_kernel void @TU0_kernel()58define dso_local spir_kernel void @TU0_kernel() #1 {59entry:60; CHECK-TU0: call spir_func void @func_TU0()61  call spir_func void @func_TU0()62  ret void63}64 65; CHECK-TU0: define {{.*}} spir_func void @func_TU0()66; CHECK-TU1-NOT: define {{.*}} spir_func void @func_TU0()67define dso_local spir_func void @func_TU0() {68entry:69; CHECK-TU0: %0 = load i32, ptr addrspace(4) addrspacecast (ptr addrspace(1) @GV to ptr addrspace(4)), align 470  %0 = load i32, ptr addrspace(4) getelementptr inbounds ([1 x i32], ptr addrspace(4) addrspacecast (ptr addrspace(1) @GV to ptr addrspace(4)), i64 0, i64 0), align 471  ret void72}73 74attributes #0 = { "module-id"="TU1.cpp" }75attributes #1 = { "module-id"="TU2.cpp" }76 77; Metadata is saved in both modules.78; CHECK: !opencl.spir.version = !{!0, !0}79; CHECK: !spirv.Source = !{!1, !1}80 81!opencl.spir.version = !{!0, !0}82!spirv.Source = !{!1, !1}83 84; CHECK: !0 = !{i32 1, i32 2}85; CHECK: !1 = !{i32 4, i32 100000}86 87!0 = !{i32 1, i32 2}88!1 = !{i32 4, i32 100000}89