[clang] [Clang][ARM] Only try to redefine builtins for non-CUDA (PR #128222)

via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 21 13:34:43 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: Nick Sarnie (sarnex)

<details>
<summary>Changes</summary>

Apply a preemptive workaround for a possible behavior change in `__has_builtin` as suggested in https://github.com/llvm/llvm-project/pull/121839 and https://github.com/llvm/llvm-project/pull/126324.

---
Full diff: https://github.com/llvm/llvm-project/pull/128222.diff


1 Files Affected:

- (modified) clang/lib/Headers/arm_acle.h (+3) 


``````````diff
diff --git a/clang/lib/Headers/arm_acle.h b/clang/lib/Headers/arm_acle.h
index b1dc90f84ad36..fbd0020258722 100644
--- a/clang/lib/Headers/arm_acle.h
+++ b/clang/lib/Headers/arm_acle.h
@@ -27,6 +27,8 @@
 extern "C" {
 #endif
 
+#if !defined(__CUDA__)
+
 /* 7 SYNCHRONIZATION, BARRIER AND HINT INTRINSICS */
 /* 7.3 Memory barriers */
 #if !__has_builtin(__dmb)
@@ -70,6 +72,7 @@ static __inline__ void __attribute__((__always_inline__, __nodebug__)) __yield(v
   __builtin_arm_yield();
 }
 #endif
+#endif // #if !defined(__CUDA__)
 
 #if defined(__ARM_32BIT_STATE) && __ARM_32BIT_STATE
 #define __dbg(t) __builtin_arm_dbg(t)

``````````

</details>


https://github.com/llvm/llvm-project/pull/128222


More information about the cfe-commits mailing list