[PATCH] D116128: [clang][driver] Warn when '-mno-outline-atomics' is used with a non-AArch64 triple

Marco Elver via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 22 03:14:52 PST 2021


melver accepted this revision.
melver added inline comments.


================
Comment at: clang/test/Driver/x86-outline-atomics.c:1-7
+// RUN: %clang -target x86_64 -moutline-atomics -S %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-OUTLINE-ATOMICS
+// CHECK-OUTLINE-ATOMICS: warning: 'x86_64' does not support '-moutline-atomics'; flag ignored [-Woption-ignored]
+// CHECK-OUTLINE-ATOMICS-NOT: "-target-feature" "+outline-atomics"
+
+// RUN: %clang -target x86_64 -mno-outline-atomics -S %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-NO-OUTLINE-ATOMICS
+// CHECK-NO-OUTLINE-ATOMICS: warning: 'x86_64' does not support '-mno-outline-atomics'; flag ignored [-Woption-ignored]
+// CHECK-NO-OUTLINE-ATOMICS-NOT: "-target-feature" "-outline-atomics"
----------------
nathanchance wrote:
> nickdesaulniers wrote:
> > If `clang/test/Driver/aarch64-features.c` is only testing outline atomics, I wonder if this test should actually go in there? @t.p.northover , thoughts? Otherwise LGTM and thanks for the patch!
> I did consider that initially but:
> 
> 1. It does appear to test a few other AArch64 specific things.
> 2. It seemed weird to add an x86_64 test to an AArch64 file.
> 
> No strong opinions though, I'll go along with whatever works and makes the majority happy.
There is a similar precedent in `clang/test/Driver/aarch64-outliner.c`, although maybe that should have been in aarch64-features.c

However, the fact it's called `x86-outline-atomics.c` makes me think that x86 supports outline atomics.

Other similar tests appear in `clang/test/Driver/unsupported-*`.

My suggestion is to call it `unsupported-outline-atomics.c`.

Furthermore, this shouldn't just warn on x86, so one more arch (say riscv or ppc?) would be useful to check as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116128/new/

https://reviews.llvm.org/D116128



More information about the cfe-commits mailing list