[clang] [Clang] __has_builtin should return false for aux triple builtins (PR #121839)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 7 08:36:49 PST 2025
erichkeane wrote:
I think I wrote the original patch. The point for allowing the 'aux' target to enable a builtin that is not supported on the 'default' target is for languages where 2-pass compilation is necessary for device/host, and the 'aux' target is used to capture that this is a 2-pass compilation.
So I think we're conflating "This should be legal in this program" and "this should be illegal to execute on THIS target". Historically, those were the same questions, but 2 pass compilation makes this no longer true. So right now this functionality is answering the 1st question, but we have no way for the 2nd question.
IMO, we probably have something where we need to have code-gen start diagnosing the 2nd question. Because something like:
```
void only_executed_on_host() {
__builtin_host_thing();
}
void device_entry_point() {
// doesn't call executed_on_host
}
```
is a pattern that we need to support.
https://github.com/llvm/llvm-project/pull/121839
More information about the cfe-commits
mailing list