[clang] [Clang] __has_builtin should return false for aux triple builtins (PR #121839)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 27 12:53:35 PST 2025


jhuber6 wrote:

> This breaks CUDA compilation on ARM, because `__has_builtin()` now returns false for the host-side builtins and that causes some clang headers on ARM to try defining their own replacement for the builtin they consider to be missing, but which is actually still there: https://godbolt.org/z/v9qffds1Y
> 
> https://github.com/llvm/llvm-project/blob/285009f202ca8bfcc6b607eba0e919867559e725/clang/lib/Headers/arm_acle.h#L44-L48

Right, the curse of merge compilation strikes again. Feels like damned if you do damned if you don't here. It's either broken inside of the device or outside of the device. It feels rather unfortunate to not have a mechanism to determine if we can actually *generate code* for a builtin. Perhaps we could make some offloading specific hack to work around that, otherwise it's tough to make generic headers that actually work.

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


More information about the cfe-commits mailing list