1 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions \
2 // RUN: -o - -x hip %s | FileCheck %s
4 #include "Inputs/cuda.h"
9 // CHECK-LABEL: define {{.*}}@_Znwm
10 // CHECK: load ptr, ptr @hvar
11 void* operator new(unsigned long size) {
14 // CHECK-LABEL: define {{.*}}@_ZdlPv
15 // CHECK: store ptr inttoptr (i64 1 to ptr), ptr @hvar
16 void operator delete(void *p) {
20 __device__ void* operator new(unsigned long size) {
24 __device__ void operator delete(void *p) {
47 // The constructor of B calls the delete operator to clean up
48 // the memory allocated by the new operator when exceptions happen.
49 // Make sure the host delete operator is used on host side.
51 // No need to do similar checks on the device side since it does
52 // not support exception.
54 // CHECK-LABEL: define {{.*}}@main
55 // CHECK: call void @_ZN1BC1Ev
57 // CHECK-LABEL: define {{.*}}@_ZN1BC1Ev
58 // CHECK: call void @_ZN1BC2Ev
60 // CHECK-LABEL: define {{.*}}@_ZN1BC2Ev
61 // CHECK: call {{.*}}@_Znwm
62 // CHECK: invoke void @_ZN1AC1Ev
63 // CHECK: call void @_ZN10shared_ptrI1AEC1EPS0_
65 // CHECK: call void @_ZdlPv
68 shared_ptr<A> pa{new A};