diff options
author | Amy Kwan <amy.kwan1@ibm.com> | 2023-06-17 00:31:35 -0500 |
---|---|---|
committer | Amy Kwan <amy.kwan1@ibm.com> | 2023-06-19 12:17:30 -0500 |
commit | 706b5472d897ca75ebd210e4109637793288bcf2 (patch) | |
tree | 945657f5d4497965686994c69e2b50939c65082b /clang | |
parent | aeb99dc48a58f872465e818d0eda7d9c3f221e06 (diff) | |
download | llvm-706b5472d897ca75ebd210e4109637793288bcf2.zip llvm-706b5472d897ca75ebd210e4109637793288bcf2.tar.gz llvm-706b5472d897ca75ebd210e4109637793288bcf2.tar.bz2 |
[AIX][TLS] Relax front end diagnostics to accept the local-exec TLS model
This patch relaxes the front end AIX diagnostics added in D102070 to accept the
local-exec TLS model, as we plan to support this model in a series of future patches.
The diagnostics are relaxed when local-exec is used as a compiler option to
`-ftls-model=*` and in the `__attribute__((tls_model("local-exec")))` attribute.
Differential Revision: https://reviews.llvm.org/D149596
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/PowerPC/aix-tls-model.cpp | 9 | ||||
-rw-r--r-- | clang/test/Sema/aix-attr-tls_model.c | 2 |
4 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index f6c04fe..dca8853 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1894,7 +1894,7 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, if (Arg *A = Args.getLastArg(OPT_ftlsmodel_EQ)) { if (T.isOSAIX()) { StringRef Name = A->getValue(); - if (Name != "global-dynamic") + if (Name != "global-dynamic" && Name != "local-exec") Diags.Report(diag::err_aix_unsupported_tls_model) << Name; } } diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 40438214..d9146a8 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -2039,7 +2039,7 @@ static void handleTLSModelAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } if (S.Context.getTargetInfo().getTriple().isOSAIX() && - Model != "global-dynamic") { + Model != "global-dynamic" && Model != "local-exec") { S.Diag(LiteralLoc, diag::err_aix_attr_unsupported_tls_model) << Model; return; } diff --git a/clang/test/CodeGen/PowerPC/aix-tls-model.cpp b/clang/test/CodeGen/PowerPC/aix-tls-model.cpp index a531f55..2b53df54 100644 --- a/clang/test/CodeGen/PowerPC/aix-tls-model.cpp +++ b/clang/test/CodeGen/PowerPC/aix-tls-model.cpp @@ -2,12 +2,12 @@ // RUN: %clang_cc1 %s -triple powerpc-unknown-aix -target-cpu pwr8 -ftls-model=global-dynamic -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-GD // RUN: not %clang_cc1 %s -triple powerpc-unknown-aix -target-cpu pwr8 -ftls-model=local-dynamic -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-LD-ERROR // RUN: not %clang_cc1 %s -triple powerpc-unknown-aix -target-cpu pwr8 -ftls-model=initial-exec -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-IE-ERROR -// RUN: not %clang_cc1 %s -triple powerpc-unknown-aix -target-cpu pwr8 -ftls-model=local-exec -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-LE-ERROR +// RUN: %clang_cc1 %s -triple powerpc-unknown-aix -target-cpu pwr8 -ftls-model=local-exec -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-LE // RUN: %clang_cc1 %s -triple powerpc64-unknown-aix -target-cpu pwr8 -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-GD // RUN: %clang_cc1 %s -triple powerpc64-unknown-aix -target-cpu pwr8 -ftls-model=global-dynamic -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-GD // RUN: not %clang_cc1 %s -triple powerpc64-unknown-aix -target-cpu pwr8 -ftls-model=local-dynamic -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-LD-ERROR // RUN: not %clang_cc1 %s -triple powerpc64-unknown-aix -target-cpu pwr8 -ftls-model=initial-exec -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-IE-ERROR -// RUN: not %clang_cc1 %s -triple powerpc64-unknown-aix -target-cpu pwr8 -ftls-model=local-exec -emit-llvm 2>&1 | FileCheck %s -check-prefix=CHECK-LE-ERROR +// RUN: %clang_cc1 %s -triple powerpc64-unknown-aix -target-cpu pwr8 -ftls-model=local-exec -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-LE int z1 = 0; int z2; @@ -23,4 +23,7 @@ int f() { // CHECK-GD: @_ZZ1fvE1y = internal thread_local global i32 0 // CHECK-LD-ERROR: error: TLS model 'local-dynamic' is not yet supported on AIX // CHECK-IE-ERROR: error: TLS model 'initial-exec' is not yet supported on AIX -// CHECK-LE-ERROR: error: TLS model 'local-exec' is not yet supported on AIX +// CHECK-LE: @z1 ={{.*}} global i32 0 +// CHECK-LE: @z2 ={{.*}} global i32 0 +// CHECK-LE: @x ={{.*}} thread_local(localexec) global i32 0 +// CHECK-LE: @_ZZ1fvE1y = internal thread_local(localexec) global i32 0 diff --git a/clang/test/Sema/aix-attr-tls_model.c b/clang/test/Sema/aix-attr-tls_model.c index 8cf3086..245a443 100644 --- a/clang/test/Sema/aix-attr-tls_model.c +++ b/clang/test/Sema/aix-attr-tls_model.c @@ -8,4 +8,4 @@ static __thread int y __attribute((tls_model("global-dynamic"))); // no-warning static __thread int y __attribute((tls_model("local-dynamic"))); // expected-error {{TLS model 'local-dynamic' is not yet supported on AIX}} static __thread int y __attribute((tls_model("initial-exec"))); // expected-error {{TLS model 'initial-exec' is not yet supported on AIX}} -static __thread int y __attribute((tls_model("local-exec"))); // expected-error {{TLS model 'local-exec' is not yet supported on AIX}} +static __thread int y __attribute((tls_model("local-exec"))); // no-warning |