|
| 1 | +; RUN: sycl-post-link -split=auto -symbols -S %s -o %t.table |
| 2 | +; RUN: FileCheck %s -input-file=%t_0.prop |
| 3 | + |
| 4 | +target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" |
| 5 | +target triple = "spir64-unknown-linux-sycldevice" |
| 6 | + |
| 7 | +@_ZL2GV = internal addrspace(1) constant [1 x i32] [i32 42], align 4 |
| 8 | +@.str = private unnamed_addr addrspace(1) constant [2 x i8] c"0\00", align 1 |
| 9 | +@.str.1 = private unnamed_addr addrspace(1) constant [11 x i8] c"assert.cpp\00", align 1 |
| 10 | +@__PRETTY_FUNCTION__._Z3foov = private unnamed_addr addrspace(1) constant [11 x i8] c"void foo()\00", align 1 |
| 11 | +@__spirv_BuiltInGlobalInvocationId = external dso_local local_unnamed_addr addrspace(1) constant <3 x i64>, align 32 |
| 12 | +@__spirv_BuiltInLocalInvocationId = external dso_local local_unnamed_addr addrspace(1) constant <3 x i64>, align 32 |
| 13 | +@_ZL10assert_fmt = internal addrspace(2) constant [85 x i8] c"%s:%d: %s: global id: [%lu,%lu,%lu], local id: [%lu,%lu,%lu] Assertion `%s` failed.\0A\00", align 1 |
| 14 | + |
| 15 | +; CHECK: [SYCL/assert used] |
| 16 | +; CHECK-DAG: _ZTSZ4mainE11TU0_kernel0 |
| 17 | +; CHECK-DAG: _ZTSZ4mainE10TU1_kernel |
| 18 | + |
| 19 | +define dso_local spir_kernel void @_ZTSZ4mainE11TU0_kernel0() #0 { |
| 20 | +entry: |
| 21 | + call spir_func void @_Z3foov() |
| 22 | + ret void |
| 23 | +} |
| 24 | + |
| 25 | +define dso_local spir_func void @_Z3foov() { |
| 26 | +entry: |
| 27 | + %a = alloca i32, align 4 |
| 28 | + %ptr = bitcast i32* %a to i32 (i32)* |
| 29 | + %call = call spir_func i32 %ptr(i32 1) |
| 30 | + %add = add nsw i32 2, %call |
| 31 | + store i32 %add, i32* %a, align 4 |
| 32 | + tail call spir_func void @__assert_fail(i8 addrspace(4)* getelementptr inbounds ([2 x i8], [2 x i8] addrspace(4)* addrspacecast ([2 x i8] addrspace(1)* @.str to [2 x i8] addrspace(4)*), i64 0, i64 0), i8 addrspace(4)* getelementptr inbounds ([11 x i8], [11 x i8] addrspace(4)* addrspacecast ([11 x i8] addrspace(1)* @.str.1 to [11 x i8] addrspace(4)*), i64 0, i64 0), i32 8, i8 addrspace(4)* getelementptr inbounds ([11 x i8], [11 x i8] addrspace(4)* addrspacecast ([11 x i8] addrspace(1)* @__PRETTY_FUNCTION__._Z3foov to [11 x i8] addrspace(4)*), i64 0, i64 0)) |
| 33 | + ret void |
| 34 | +} |
| 35 | + |
| 36 | +define dso_local spir_kernel void @_ZTSZ4mainE11TU0_kernel1() #0 { |
| 37 | +entry: |
| 38 | + call spir_func void @_Z4foo1v() |
| 39 | + ret void |
| 40 | +} |
| 41 | + |
| 42 | +; Function Attrs: nounwind |
| 43 | +define dso_local spir_func void @_Z4foo1v() { |
| 44 | +entry: |
| 45 | + %a = alloca i32, align 4 |
| 46 | + store i32 2, i32* %a, align 4 |
| 47 | + ret void |
| 48 | +} |
| 49 | + |
| 50 | +define dso_local spir_kernel void @_ZTSZ4mainE10TU1_kernel() #1 { |
| 51 | +entry: |
| 52 | + call spir_func void @_Z4foo2v() |
| 53 | + ret void |
| 54 | +} |
| 55 | + |
| 56 | +; Function Attrs: nounwind |
| 57 | +define dso_local spir_func void @_Z4foo2v() { |
| 58 | +entry: |
| 59 | + %a = alloca i32, align 4 |
| 60 | + %0 = load i32, i32 addrspace(4)* getelementptr inbounds ([1 x i32], [1 x i32] addrspace(4)* addrspacecast ([1 x i32] addrspace(1)* @_ZL2GV to [1 x i32] addrspace(4)*), i64 0, i64 0), align 4 |
| 61 | + %add = add nsw i32 4, %0 |
| 62 | + store i32 %add, i32* %a, align 4 |
| 63 | + tail call spir_func void @__assert_fail(i8 addrspace(4)* getelementptr inbounds ([2 x i8], [2 x i8] addrspace(4)* addrspacecast ([2 x i8] addrspace(1)* @.str to [2 x i8] addrspace(4)*), i64 0, i64 0), i8 addrspace(4)* getelementptr inbounds ([11 x i8], [11 x i8] addrspace(4)* addrspacecast ([11 x i8] addrspace(1)* @.str.1 to [11 x i8] addrspace(4)*), i64 0, i64 0), i32 8, i8 addrspace(4)* getelementptr inbounds ([11 x i8], [11 x i8] addrspace(4)* addrspacecast ([11 x i8] addrspace(1)* @__PRETTY_FUNCTION__._Z3foov to [11 x i8] addrspace(4)*), i64 0, i64 0)) |
| 64 | + ret void |
| 65 | +} |
| 66 | + |
| 67 | +; Function Attrs: convergent norecurse mustprogress |
| 68 | +define weak dso_local spir_func void @__assert_fail(i8 addrspace(4)* %expr, i8 addrspace(4)* %file, i32 %line, i8 addrspace(4)* %func) local_unnamed_addr { |
| 69 | +entry: |
| 70 | + %call = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() |
| 71 | + %call1 = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_yv() |
| 72 | + %call2 = tail call spir_func i64 @_Z28__spirv_GlobalInvocationId_zv() |
| 73 | + %call3 = tail call spir_func i64 @_Z27__spirv_LocalInvocationId_xv() |
| 74 | + %call4 = tail call spir_func i64 @_Z27__spirv_LocalInvocationId_yv() |
| 75 | + %call5 = tail call spir_func i64 @_Z27__spirv_LocalInvocationId_zv() |
| 76 | + tail call spir_func void @__devicelib_assert_fail(i8 addrspace(4)* %expr, i8 addrspace(4)* %file, i32 %line, i8 addrspace(4)* %func, i64 %call, i64 %call1, i64 %call2, i64 %call3, i64 %call4, i64 %call5) |
| 77 | + ret void |
| 78 | +} |
| 79 | + |
| 80 | +; Function Attrs: inlinehint norecurse mustprogress |
| 81 | +define weak dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_xv() local_unnamed_addr { |
| 82 | +entry: |
| 83 | + %0 = load <3 x i64>, <3 x i64> addrspace(4)* addrspacecast (<3 x i64> addrspace(1)* @__spirv_BuiltInGlobalInvocationId to <3 x i64> addrspace(4)*), align 32 |
| 84 | + %1 = extractelement <3 x i64> %0, i64 0 |
| 85 | + ret i64 %1 |
| 86 | +} |
| 87 | + |
| 88 | +; Function Attrs: inlinehint norecurse mustprogress |
| 89 | +define weak dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_yv() local_unnamed_addr { |
| 90 | +entry: |
| 91 | + %0 = load <3 x i64>, <3 x i64> addrspace(4)* addrspacecast (<3 x i64> addrspace(1)* @__spirv_BuiltInGlobalInvocationId to <3 x i64> addrspace(4)*), align 32 |
| 92 | + %1 = extractelement <3 x i64> %0, i64 1 |
| 93 | + ret i64 %1 |
| 94 | +} |
| 95 | + |
| 96 | +; Function Attrs: inlinehint norecurse mustprogress |
| 97 | +define weak dso_local spir_func i64 @_Z28__spirv_GlobalInvocationId_zv() local_unnamed_addr { |
| 98 | +entry: |
| 99 | + %0 = load <3 x i64>, <3 x i64> addrspace(4)* addrspacecast (<3 x i64> addrspace(1)* @__spirv_BuiltInGlobalInvocationId to <3 x i64> addrspace(4)*), align 32 |
| 100 | + %1 = extractelement <3 x i64> %0, i64 2 |
| 101 | + ret i64 %1 |
| 102 | +} |
| 103 | + |
| 104 | +; Function Attrs: inlinehint norecurse mustprogress |
| 105 | +define weak dso_local spir_func i64 @_Z27__spirv_LocalInvocationId_xv() local_unnamed_addr { |
| 106 | +entry: |
| 107 | + %0 = load <3 x i64>, <3 x i64> addrspace(4)* addrspacecast (<3 x i64> addrspace(1)* @__spirv_BuiltInLocalInvocationId to <3 x i64> addrspace(4)*), align 32 |
| 108 | + %1 = extractelement <3 x i64> %0, i64 0 |
| 109 | + ret i64 %1 |
| 110 | +} |
| 111 | + |
| 112 | +; Function Attrs: inlinehint norecurse mustprogress |
| 113 | +define weak dso_local spir_func i64 @_Z27__spirv_LocalInvocationId_yv() local_unnamed_addr { |
| 114 | +entry: |
| 115 | + %0 = load <3 x i64>, <3 x i64> addrspace(4)* addrspacecast (<3 x i64> addrspace(1)* @__spirv_BuiltInLocalInvocationId to <3 x i64> addrspace(4)*), align 32 |
| 116 | + %1 = extractelement <3 x i64> %0, i64 1 |
| 117 | + ret i64 %1 |
| 118 | +} |
| 119 | + |
| 120 | +; Function Attrs: inlinehint norecurse mustprogress |
| 121 | +define weak dso_local spir_func i64 @_Z27__spirv_LocalInvocationId_zv() local_unnamed_addr { |
| 122 | +entry: |
| 123 | + %0 = load <3 x i64>, <3 x i64> addrspace(4)* addrspacecast (<3 x i64> addrspace(1)* @__spirv_BuiltInLocalInvocationId to <3 x i64> addrspace(4)*), align 32 |
| 124 | + %1 = extractelement <3 x i64> %0, i64 2 |
| 125 | + ret i64 %1 |
| 126 | +} |
| 127 | + |
| 128 | +; Function Attrs: convergent norecurse mustprogress |
| 129 | +define weak dso_local spir_func void @__devicelib_assert_fail(i8 addrspace(4)* %expr, i8 addrspace(4)* %file, i32 %line, i8 addrspace(4)* %func, i64 %gid0, i64 %gid1, i64 %gid2, i64 %lid0, i64 %lid1, i64 %lid2) local_unnamed_addr { |
| 130 | +entry: |
| 131 | + %call = tail call spir_func i32 (i8 addrspace(2)*, ...) @_Z18__spirv_ocl_printfPU3AS2Kcz(i8 addrspace(2)* getelementptr inbounds ([85 x i8], [85 x i8] addrspace(2)* @_ZL10assert_fmt, i64 0, i64 0), i8 addrspace(4)* %file, i32 %line, i8 addrspace(4)* %func, i64 %gid0, i64 %gid1, i64 %gid2, i64 %lid0, i64 %lid1, i64 %lid2, i8 addrspace(4)* %expr) |
| 132 | + ret void |
| 133 | +} |
| 134 | + |
| 135 | +; Function Attrs: convergent |
| 136 | +declare dso_local spir_func i32 @_Z18__spirv_ocl_printfPU3AS2Kcz(i8 addrspace(2)*, ...) local_unnamed_addr |
| 137 | + |
| 138 | +attributes #0 = { "sycl-module-id"="TU1.cpp" } |
| 139 | +attributes #1 = { "sycl-module-id"="TU2.cpp" } |
| 140 | + |
| 141 | +!opencl.spir.version = !{!0, !0} |
| 142 | +!spirv.Source = !{!1, !1} |
| 143 | + |
| 144 | +!0 = !{i32 1, i32 2} |
| 145 | +!1 = !{i32 4, i32 100000} |
0 commit comments