32
32
// RUN: -target-cpu gfx906 -emit-llvm %s -fcuda-is-device -o - \
33
33
// RUN: -DHIP_VERSION_MAJOR=4 -DHIP_VERSION_MINOR=5 \
34
34
// RUN: -D__HIPCC_RTC__ | FileCheck -check-prefixes=CHECK,MALLOC %s
35
+ // RUN: %clang_cc1 -no-opaque-pointers -include __clang_hip_runtime_wrapper.h \
36
+ // RUN: -internal-isystem %S/../../lib/Headers/cuda_wrappers \
37
+ // RUN: -internal-isystem %S/Inputs/include \
38
+ // RUN: -triple amdgcn-amd-amdhsa -aux-triple x86_64-unknown-unknown \
39
+ // RUN: -target-cpu gfx906 -emit-llvm %s -fcuda-is-device -o - \
40
+ // RUN: -DHIP_VERSION_MAJOR=4 -DHIP_VERSION_MINOR=5 \
41
+ // RUN: -fsanitize=address -disable-llvm-passes -D__HIPCC_RTC__ \
42
+ // RUN: | FileCheck -check-prefixes=MALLOC-ASAN %s
35
43
36
44
// expected-no-diagnostics
37
45
@@ -130,6 +138,9 @@ __device__ double test_isnan() {
130
138
// CHECK-LABEL: define weak {{.*}}i8* @malloc(i64
131
139
// MALLOC: call i64 @__ockl_dm_alloc
132
140
// NOMALLOC: call void @llvm.trap
141
+ // MALLOC-ASAN-LABEL: define weak {{.*}}i8* @malloc(i64
142
+ // MALLOC-ASAN: call i8* @llvm.returnaddress(i32 0)
143
+ // MALLOC-ASAN: call i64 @__asan_malloc_impl(i64 {{.*}}, i64 {{.*}})
133
144
__device__ void test_malloc (void *a) {
134
145
a = malloc (42 );
135
146
}
@@ -139,6 +150,9 @@ __device__ void test_malloc(void *a) {
139
150
// CHECK-LABEL: define weak {{.*}}void @free(i8*
140
151
// MALLOC: call void @__ockl_dm_dealloc
141
152
// NOMALLOC: call void @llvm.trap
153
+ // MALLOC-ASAN-LABEL: define weak {{.*}}void @free(i8*
154
+ // MALLOC-ASAN: call i8* @llvm.returnaddress(i32 0)
155
+ // MALLOC-ASAN: call void @__asan_free_impl(i64 {{.*}}, i64 {{.*}})
142
156
__device__ void test_free (void *a) {
143
157
free (a);
144
158
}
0 commit comments