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

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 7 06:24:13 PST 2025


AlexVlx wrote:

> `CodeGenHipStdPar/unsupported-builtins.cpp` is pretty interesting actually, it looks like it tests for some behavior in CodeGen that seems like it's trying to fix the exact same problem
> 
> The other two tests seem to be actually unrelated breakages though.

It is not quite trying to fix a problem:). In hipstdpar mode there's no host/device segregation, and it is possible to codegen IR for host only bits (e.g., parts of the stdlib). We delay resolving whether a construct is or isn't viable to the ME, and just place in these special stubs where the otherwise unsupported construct (in this case a builtin) is used. Then, iff it turns out that the code path that reaches the unsupported construct is accessible, we error out - please see <https://reviews.llvm.org/D155850> and <https://reviews.llvm.org/D155856> for historical context. 

I don't quite think that this change interacts with that at all (I'll look again), but it might interact in some subtle way with offload languages such as e.g. HIP which jump through some hoops to keep the AST consistent, so I've added @yxsamliu to this review.

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


More information about the cfe-commits mailing list