Skip to content

Commit b440fb7

Browse files
authored
[Clang][CUDA] Replace inline asm in __trap() with intrinsic (llvm#166152)
This patch proposes replacing the inline assembly with an intrinsic and adds the `noreturn` to avoid warnings when the caller is also `noreturn`.
1 parent 6e5f277 commit b440fb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Headers/__clang_cuda_device_functions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ __DEVICE__ float __tanf(float __a) { return __nv_fast_tanf(__a); }
528528
__DEVICE__ void __threadfence(void) { __nvvm_membar_gl(); }
529529
__DEVICE__ void __threadfence_block(void) { __nvvm_membar_cta(); };
530530
__DEVICE__ void __threadfence_system(void) { __nvvm_membar_sys(); };
531-
__DEVICE__ void __trap(void) { __asm__ __volatile__("trap;"); }
531+
__DEVICE__ __attribute__((noreturn)) void __trap(void) { __builtin_trap(); }
532532
__DEVICE__ unsigned short
533533
__usAtomicCAS(unsigned short *__p, unsigned short __cmp, unsigned short __v) {
534534
return __nvvm_atom_cas_gen_us(__p, __cmp, __v);

0 commit comments

Comments
 (0)