[PATCH] D86105: [darwin] Disable the -Wpsabi warning
Alex Lorenz via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 17 13:26:27 PDT 2020
arphaman created this revision.
arphaman added reviewers: ab, t.p.northover, erichkeane.
Herald added subscribers: ributzka, dexonsmith, jkorous.
arphaman requested review of this revision.
The Darwin targets don't enable AVX/AVX512 by default to support Rosetta 2, so the new -Wpsabi warning adds unwanted noise to our SDK. Users who build for AVX/AVX512 for Darwin are already supposed to take extra care when it comes to the ABI differences and the SDK.
https://reviews.llvm.org/D86105
Files:
clang/lib/CodeGen/TargetInfo.cpp
clang/test/CodeGen/target-avx-abi-diag.c
Index: clang/test/CodeGen/target-avx-abi-diag.c
===================================================================
--- clang/test/CodeGen/target-avx-abi-diag.c
+++ clang/test/CodeGen/target-avx-abi-diag.c
@@ -1,6 +1,9 @@
-// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -verify=no256,no512 -o - -S
-// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -target-feature +avx -verify=no512 -o - -S
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -verify=no256,no512,no256-err,no512-err -o - -S
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -target-feature +avx -verify=no512,no512-err -o - -S
// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -target-feature +avx512f -verify=both -o - -S
+
+// RUN: %clang_cc1 %s -triple=x86_64-apple-macos -verify=no256-err,no512-err -o - -S
+// RUN: %clang_cc1 %s -triple=x86_64-apple-macos -target-feature +avx -verify=no512-err -o - -S
// REQUIRES: x86-registered-target
// both-no-diagnostics
@@ -31,12 +34,12 @@
// If only 1 side has an attribute, error.
void call_errors(void) {
avx256Type t1;
- takesAvx256(t1); // no256-error {{AVX vector argument of type 'avx256Type' (vector of 16 'short' values) without 'avx' enabled changes the ABI}}
+ takesAvx256(t1); // no256-err-error {{AVX vector argument of type 'avx256Type' (vector of 16 'short' values) without 'avx' enabled changes the ABI}}
avx512fType t2;
- takesAvx512(t2); // no512-error {{AVX vector argument of type 'avx512fType' (vector of 32 'short' values) without 'avx512f' enabled changes the ABI}}
+ takesAvx512(t2); // no512-err-error {{AVX vector argument of type 'avx512fType' (vector of 32 'short' values) without 'avx512f' enabled changes the ABI}}
- variadic_err(1, t1); // no256-error {{AVX vector argument of type 'avx256Type' (vector of 16 'short' values) without 'avx' enabled changes the ABI}}
- variadic_err(3, t2); // no512-error {{AVX vector argument of type 'avx512fType' (vector of 32 'short' values) without 'avx512f' enabled changes the ABI}}
+ variadic_err(1, t1); // no256-err-error {{AVX vector argument of type 'avx256Type' (vector of 16 'short' values) without 'avx' enabled changes the ABI}}
+ variadic_err(3, t2); // no512-err-error {{AVX vector argument of type 'avx512fType' (vector of 32 'short' values) without 'avx512f' enabled changes the ABI}}
}
// These two don't diagnose anything, since these are valid calls.
Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -2508,12 +2508,17 @@
const llvm::StringMap<bool> &CallerMap,
const llvm::StringMap<bool> &CalleeMap,
QualType Ty, StringRef Feature,
- bool IsArgument) {
+ bool IsArgument, const llvm::Triple &TT) {
bool CallerHasFeat = CallerMap.lookup(Feature);
bool CalleeHasFeat = CalleeMap.lookup(Feature);
- if (!CallerHasFeat && !CalleeHasFeat)
+ if (!CallerHasFeat && !CalleeHasFeat) {
+ // Darwin doesn't enable AVX/AVX512 by default to support Rosetta 2, so it's
+ // user's responsibility to use AVX/AVX512 safely.
+ if (TT.isOSDarwin())
+ return false;
return Diag.Report(CallLoc, diag::warn_avx_calling_convention)
<< IsArgument << Ty << Feature;
+ }
// Mixing calling conventions here is very clearly an error.
if (!CallerHasFeat || !CalleeHasFeat)
@@ -2531,13 +2536,14 @@
const llvm::StringMap<bool> &CalleeMap, QualType Ty,
bool IsArgument) {
uint64_t Size = Ctx.getTypeSize(Ty);
+ const llvm::Triple &TT = Ctx.getTargetInfo().getTriple();
if (Size > 256)
return checkAVXParamFeature(Diag, CallLoc, CallerMap, CalleeMap, Ty,
- "avx512f", IsArgument);
+ "avx512f", IsArgument, TT);
if (Size > 128)
return checkAVXParamFeature(Diag, CallLoc, CallerMap, CalleeMap, Ty, "avx",
- IsArgument);
+ IsArgument, TT);
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86105.286126.patch
Type: text/x-patch
Size: 4192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200817/de4b4d4c/attachment.bin>
More information about the cfe-commits
mailing list