1 // Create a sample address sanitizer bitcode library.
2 
3 // RUN: %clang_cc1 -no-opaque-pointers -x ir -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm-bc \
4 // RUN:   -disable-llvm-passes -o %t.asanrtl.bc %S/Inputs/amdgpu-asanrtl.ll
5 
6 // Check sanitizer runtime library functions survive
7 // optimizations without being removed or parameters altered.
8 
9 // RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
10 // RUN:   -fcuda-is-device -target-cpu gfx906 -fsanitize=address \
11 // RUN:   -mlink-bitcode-file %t.asanrtl.bc -x hip \
12 // RUN:   | FileCheck -check-prefixes=ASAN %s
13 
14 // RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
15 // RUN:   -fcuda-is-device -target-cpu gfx906 -fsanitize=address \
16 // RUN:   -O3 -mlink-bitcode-file %t.asanrtl.bc -x hip \
17 // RUN:   | FileCheck -check-prefixes=ASAN %s
18 
19 // RUN: %clang_cc1 -no-opaque-pointers %s -emit-llvm -o - -triple=amdgcn-amd-amdhsa \
20 // RUN:   -fcuda-is-device -target-cpu gfx906 -x hip \
21 // RUN:   | FileCheck %s
22 
23 // REQUIRES: amdgpu-registered-target
24 
25 // ASAN-DAG: define weak void @__amdgpu_device_library_preserve_asan_functions()
26 // ASAN-DAG: @__amdgpu_device_library_preserve_asan_functions_ptr = weak addrspace(1) constant void ()* @__amdgpu_device_library_preserve_asan_functions
27 // ASAN-DAG: @llvm.compiler.used = {{.*}}@__amdgpu_device_library_preserve_asan_functions_ptr
28 // ASAN-DAG: define weak void @__asan_report_load1(i64 %{{.*}})
29 
30 // CHECK-NOT: @__amdgpu_device_library_preserve_asan_functions
31 // CHECK-NOT: @__asan_report_load1
32