|
| 1 | +; This test checks that the post-link tool properly generates "sanUsed=msan" |
| 2 | +; in [SYCL/misc properties], and fixes the attributes and metadata of @__MsanKernelMetadata |
| 3 | + |
| 4 | +; RUN: sycl-post-link -properties -split=kernel -symbols -S < %s -o %t.table |
| 5 | + |
| 6 | +; RUN: FileCheck %s -input-file=%t_0.prop --check-prefix CHECK-PROP |
| 7 | +; CHECK-PROP: [SYCL/misc properties] |
| 8 | +; CHECK-PROP: sanUsed=2|gAAAAAAAAAQbzFmb |
| 9 | + |
| 10 | +; RUN: FileCheck %s -input-file=%t_0.ll --check-prefix CHECK-IR |
| 11 | + |
| 12 | +; ModuleID = 'check_call.cpp' |
| 13 | +source_filename = "check_call.cpp" |
| 14 | +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" |
| 15 | +target triple = "spir64-unknown-unknown" |
| 16 | + |
| 17 | +$_ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_E8MyKernel = comdat any |
| 18 | + |
| 19 | +@__msan_kernel = internal addrspace(1) constant [55 x i8] c"_ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_E8MyKernel\00" |
| 20 | +@__MsanKernelMetadata = appending dso_local local_unnamed_addr addrspace(1) global [1 x { i64, i64 }] [{ i64, i64 } { i64 ptrtoint (ptr addrspace(1) @__msan_kernel to i64), i64 54 }] #0 |
| 21 | +; CHECK-IR: @__MsanKernelMetadata {{.*}} !spirv.Decorations |
| 22 | +@__spirv_BuiltInGlobalInvocationId = external dso_local local_unnamed_addr addrspace(1) constant <3 x i64>, align 32 |
| 23 | +@__asan_func = internal addrspace(2) constant [106 x i8] c"typeinfo name for main::'lambda'(sycl::_V1::handler&)::operator()(sycl::_V1::handler&) const::MyKernelR_4\00" |
| 24 | + |
| 25 | +; Function Attrs: mustprogress norecurse nounwind sanitize_memory uwtable |
| 26 | +define weak_odr dso_local spir_kernel void @_ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_E8MyKernel(ptr addrspace(1) noundef align 4 %_arg_array) local_unnamed_addr #1 comdat !srcloc !6 !kernel_arg_buffer_location !7 !sycl_fixed_targets !8 { |
| 27 | +entry: |
| 28 | + %0 = load i32, ptr addrspace(1) %_arg_array, align 4 |
| 29 | + %1 = ptrtoint ptr addrspace(1) %_arg_array to i64 |
| 30 | + %2 = call i64 @__msan_get_shadow(i64 %1, i32 1) |
| 31 | + %3 = inttoptr i64 %2 to ptr addrspace(1) |
| 32 | + %_msld = load i32, ptr addrspace(1) %3, align 4 |
| 33 | + %arrayidx3.i = getelementptr inbounds i8, ptr addrspace(1) %_arg_array, i64 4 |
| 34 | + %4 = load i32, ptr addrspace(1) %arrayidx3.i, align 4 |
| 35 | + %5 = ptrtoint ptr addrspace(1) %arrayidx3.i to i64 |
| 36 | + %6 = call i64 @__msan_get_shadow(i64 %5, i32 1) |
| 37 | + %7 = inttoptr i64 %6 to ptr addrspace(1) |
| 38 | + %_msld2 = load i32, ptr addrspace(1) %7, align 4 |
| 39 | + %_msprop = sext i32 %_msld2 to i64 |
| 40 | + %conv.i = sext i32 %4 to i64 |
| 41 | + %_mscmp = icmp ne i32 %_msld, 0 |
| 42 | + %_mscmp3 = icmp ne i64 %_msprop, 0 |
| 43 | + %_msor = or i1 %_mscmp, %_mscmp3 |
| 44 | + %8 = zext i1 %_msor to i8 |
| 45 | + call void @__msan_maybe_warning_1(i8 zeroext %8, i32 zeroext 0, ptr addrspace(2) null, i32 0, ptr addrspace(2) @__asan_func) |
| 46 | + %call.i = tail call spir_func noundef i64 @_Z3fooix(i32 noundef %0, i64 noundef %conv.i) #4 |
| 47 | + %conv4.i = trunc i64 %call.i to i32 |
| 48 | + %9 = ptrtoint ptr addrspace(1) %_arg_array to i64 |
| 49 | + %10 = call i64 @__msan_get_shadow(i64 %9, i32 1) |
| 50 | + %11 = inttoptr i64 %10 to ptr addrspace(1) |
| 51 | + store i32 0, ptr addrspace(1) %11, align 4 |
| 52 | + store i32 %conv4.i, ptr addrspace(1) %_arg_array, align 4 |
| 53 | + ret void |
| 54 | +} |
| 55 | + |
| 56 | +; Function Attrs: mustprogress noinline norecurse nounwind sanitize_memory uwtable |
| 57 | +define linkonce_odr dso_local spir_func noundef i64 @_Z3fooix(i32 noundef %data1, i64 noundef %data2) local_unnamed_addr #2 { |
| 58 | +entry: |
| 59 | + %conv = sext i32 %data1 to i64 |
| 60 | + %add = add nsw i64 %data2, %conv |
| 61 | + ret i64 %add |
| 62 | +} |
| 63 | + |
| 64 | +declare i64 @__msan_get_shadow(i64, i32) |
| 65 | +declare void @__msan_maybe_warning_1(i8, i32, ptr addrspace(2), i32, ptr addrspace(2)) |
| 66 | + |
| 67 | +attributes #0 = { "sycl-device-global-size"="16" "sycl-device-image-scope" "sycl-host-access"="0" "sycl-unique-id"="_Z20__MsanKernelMetadata" } |
| 68 | +attributes #1 = { mustprogress norecurse nounwind sanitize_memory uwtable "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="check_call.cpp" "sycl-single-task" "uniform-work-group-size"="true" } |
| 69 | +attributes #2 = { mustprogress noinline norecurse nounwind sanitize_memory uwtable "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" } |
| 70 | + |
| 71 | +!llvm.module.flags = !{!0, !1, !2} |
| 72 | +!opencl.spir.version = !{!3} |
| 73 | +!spirv.Source = !{!4} |
| 74 | +!llvm.ident = !{!5} |
| 75 | + |
| 76 | +!0 = !{i32 1, !"wchar_size", i32 4} |
| 77 | +!1 = !{i32 7, !"uwtable", i32 2} |
| 78 | +!2 = !{i32 7, !"frame-pointer", i32 2} |
| 79 | +!3 = !{i32 1, i32 2} |
| 80 | +!4 = !{i32 4, i32 100000} |
| 81 | +!5 = !{!"clang version 19.0.0git (https://github.com/intel/llvm f8eada76c08c6a5e6c5842842ac5b98fa72669be)"} |
| 82 | +!6 = !{i32 563} |
| 83 | +!7 = !{i32 -1} |
| 84 | +!8 = !{} |
0 commit comments