aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
diff options
context:
space:
mode:
authorDan Gohman <dev@sunfishcode.online>2022-05-20 15:16:10 -0700
committerDan Gohman <dev@sunfishcode.online>2022-05-20 15:18:19 -0700
commit59726668f1dcb32883de4cf027fe3585ca384cf5 (patch)
tree0f40693f823706cfc5c93c50b29673a9e3ef0744 /llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
parentb369762beb70dfef22c7e793aed79b94d7dc0757 (diff)
downloadllvm-59726668f1dcb32883de4cf027fe3585ca384cf5.zip
llvm-59726668f1dcb32883de4cf027fe3585ca384cf5.tar.gz
llvm-59726668f1dcb32883de4cf027fe3585ca384cf5.tar.bz2
[WebAssembly] Strip TLS when "atomics" is not enabled
With f3b4f99007cdcb3306484c9a39d31addc20aaa69, the exclusive source of truth for whether threads are supported is the -matomics flag. Accordingly, strip TLS flags when -matomic is not specified, even if bulk-memory is specified and it would theoretically be supportable. This allows the backend to compile TLS variables when -mbulk-memory is enabled but threads are not enabled. Differential Revision: https://reviews.llvm.org/D125730
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
index 0312478..93dd546 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -203,11 +203,12 @@ public:
bool StrippedAtomics = false;
bool StrippedTLS = false;
- if (!Features[WebAssembly::FeatureAtomics])
+ if (!Features[WebAssembly::FeatureAtomics]) {
StrippedAtomics = stripAtomics(M);
-
- if (!Features[WebAssembly::FeatureBulkMemory])
StrippedTLS = stripThreadLocals(M);
+ } else if (!Features[WebAssembly::FeatureBulkMemory]) {
+ StrippedTLS |= stripThreadLocals(M);
+ }
if (StrippedAtomics && !StrippedTLS)
stripThreadLocals(M);