-
Notifications
You must be signed in to change notification settings - Fork 14k
[clang] Fix -fclang-abi-compat for clang 20 #144109
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
The value was known already, but it was parsed as latest which is incorrect because we are already doing clang 21.
@llvm/pr-subscribers-clang @llvm/pr-subscribers-backend-x86 Author: Mariya Podchishchaeva (Fznamznon) ChangesThe value was known already, but it was parsed as latest which is incorrect because we are already doing clang 21. Full diff: https://github.com/llvm/llvm-project/pull/144109.diff 2 Files Affected:
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 2c02719121c73..9c0890713dc06 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4475,6 +4475,8 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.setClangABICompat(LangOptions::ClangABI::Ver18);
else if (Major <= 19)
Opts.setClangABICompat(LangOptions::ClangABI::Ver19);
+ else if (Major <= 20)
+ Opts.setClangABICompat(LangOptions::ClangABI::Ver20);
} else if (Ver != "latest") {
Diags.Report(diag::err_drv_invalid_value)
<< A->getAsString(Args) << A->getValue();
diff --git a/clang/test/CodeGen/X86/avx-cxx-record.cpp b/clang/test/CodeGen/X86/avx-cxx-record.cpp
index bcd9c361fda90..6ce6815a521a1 100644
--- a/clang/test/CodeGen/X86/avx-cxx-record.cpp
+++ b/clang/test/CodeGen/X86/avx-cxx-record.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -O2 -target-cpu x86-64-v3 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -O2 -target-cpu x86-64-v3 -fclang-abi-compat=20 -o - | FileCheck --check-prefix CLANG-20 %s
using UInt64x2 = unsigned long long __attribute__((__vector_size__(16), may_alias));
@@ -11,6 +12,7 @@ struct XMM2 : XMM1<0>, XMM1<1> {
};
// CHECK: define{{.*}} @_Z3foov({{.*}} [[ARG:%.*]]){{.*}}
+// CLANG-20: define{{.*}} <4 x double> @_Z3foov()
// CHECK: entry:
// CHECK-NEXT: store {{.*}}, ptr [[ARG]]{{.*}}
// CHECK-NEXT: [[TMP1:%.*]] = getelementptr {{.*}}, ptr [[ARG]]{{.*}}
|
@@ -11,6 +12,7 @@ struct XMM2 : XMM1<0>, XMM1<1> { | |||
}; | |||
|
|||
// CHECK: define{{.*}} @_Z3foov({{.*}} [[ARG:%.*]]){{.*}} | |||
// CLANG-20: define{{.*}} <4 x double> @_Z3foov() |
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.
I think this is the only test which is different between clang 20 and clang 21, hence the change.
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.
LGTM! It would be nice if we could find a way to make this easier as we put out releases though. This is super easy to forget to update after branching a release.
The value was known already, but it was parsed as latest which is incorrect because we are already doing clang 21.