-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Revert "[Clang] __has_builtin should return false for aux triple builtins (#121839) #124626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…tins (llvm#121839)" This reverts commit 1c28b92. Breaks CUDA on ARM.
@llvm/pr-subscribers-clang Author: Nick Sarnie (sarnex) ChangesThis reverts commit 1c28b92. Breaks CUDA on ARM. Full diff: https://github.com/llvm/llvm-project/pull/124626.diff 3 Files Affected:
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 9cf29668f251fc..347c13da0ad215 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -1804,9 +1804,8 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
diag::err_feature_check_malformed);
if (!II)
return false;
- auto BuiltinID = II->getBuiltinID();
- if (BuiltinID != 0) {
- switch (BuiltinID) {
+ else if (II->getBuiltinID() != 0) {
+ switch (II->getBuiltinID()) {
case Builtin::BI__builtin_cpu_is:
return getTargetInfo().supportsCpuIs();
case Builtin::BI__builtin_cpu_init:
@@ -1819,11 +1818,8 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
// usual allocation and deallocation functions. Required by libc++
return 201802;
default:
- // __has_builtin should return false for aux builtins.
- if (getBuiltinInfo().isAuxBuiltinID(BuiltinID))
- return false;
return Builtin::evaluateRequiredTargetFeatures(
- getBuiltinInfo().getRequiredFeatures(BuiltinID),
+ getBuiltinInfo().getRequiredFeatures(II->getBuiltinID()),
getTargetInfo().getTargetOpts().FeatureMap);
}
return true;
diff --git a/clang/test/Headers/__cpuidex_conflict.c b/clang/test/Headers/__cpuidex_conflict.c
index 0f5e6e5e0a0ff4..8687a6aa2f897a 100644
--- a/clang/test/Headers/__cpuidex_conflict.c
+++ b/clang/test/Headers/__cpuidex_conflict.c
@@ -3,9 +3,7 @@
// RUN: %clang_cc1 %s -ffreestanding -fms-extensions -fms-compatibility \
// RUN: -fms-compatibility-version=19.00 -triple x86_64-pc-windows-msvc -emit-llvm -o -
// %clang_cc1 %s -ffreestanding -triple x86_64-w64-windows-gnu -fms-extensions -emit-llvm -o -
-//
-// FIXME: See https://github.com/llvm/llvm-project/pull/121839
-// RUN: not %clang_cc1 %s -ffreestanding -fopenmp -fopenmp-is-target-device -aux-triple x86_64-unknown-linux-gnu
+// RUN: %clang_cc1 %s -ffreestanding -fopenmp -fopenmp-is-target-device -aux-triple x86_64-unknown-linux-gnu
typedef __SIZE_TYPE__ size_t;
diff --git a/clang/test/Preprocessor/builtin_aux_info.cpp b/clang/test/Preprocessor/builtin_aux_info.cpp
deleted file mode 100644
index 60c8c6c492479a..00000000000000
--- a/clang/test/Preprocessor/builtin_aux_info.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-// RUN: %clang_cc1 -fopenmp -triple=spirv64 -fopenmp-is-target-device \
-// RUN: -aux-triple x86_64-linux-unknown -E %s | FileCheck -implicit-check-not=BAD %s
-
-// RUN: %clang_cc1 -fopenmp -triple=nvptx64 -fopenmp-is-target-device \
-// RUN: -aux-triple x86_64-linux-unknown -E %s | FileCheck -implicit-check-not=BAD %s
-
-// RUN: %clang_cc1 -fopenmp -triple=amdgcn-amd-amdhsa -fopenmp-is-target-device \
-// RUN: -aux-triple x86_64-linux-unknown -E %s | FileCheck -implicit-check-not=BAD %s
-
-// RUN: %clang_cc1 -fopenmp -triple=aarch64 -fopenmp-is-target-device \
-// RUN: -aux-triple x86_64-linux-unknown -E %s | FileCheck -implicit-check-not=BAD %s
-
-// CHECK: GOOD
-#if __has_builtin(__builtin_ia32_pause)
- BAD
-#else
- GOOD
-#endif
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I'm wondering if this can only be solved with another preprocessor macro that's like "Can this be used, no I mean it." just for these weird offloading language cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sad.... I saw the other thing, I'm not sure how we can manage that without a new builtin just so CUDA can do what they need here.
Yeah I was thinking maybe we could add a new macro or a new argument to the existing one or something to control the behavior, I can look into it after this. |
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/12525 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/21077 Here is the relevant piece of the build log for the reference
|
This reverts commit 1c28b92.
Breaks CUDA on ARM, see here.