[clang] [lld] [llvm] [WebAssembly] Cooperative threading for WASIP3 (PR #200855)
Sy Brand via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 22 13:48:02 PDT 2026
================
@@ -278,10 +278,17 @@ class CoalesceFeaturesAndStripAtomics final : public ModulePass {
bool StrippedAtomics = false;
bool StrippedTLS = false;
+ // In cooperative threading mode, thread locals are meaningful even without
+ // atomics.
+ bool CooperativeThreading =
+ WasmTM->getSubtargetImpl()->hasCooperativeMultithreading();
+
if (!Features[WebAssembly::FeatureAtomics]) {
StrippedAtomics = stripAtomics(M);
- StrippedTLS = stripThreadLocals(M);
- } else if (!Features[WebAssembly::FeatureBulkMemory]) {
+ if (!CooperativeThreading)
+ StrippedTLS = stripThreadLocals(M);
+ }
+ if (!Features[WebAssembly::FeatureBulkMemory]) {
StrippedTLS |= stripThreadLocals(M);
----------------
TartanLlama wrote:
Ah, I forgot `|=` doesn't short-circuit, I've changed the condition to ensure it's called called twice
https://github.com/llvm/llvm-project/pull/200855
More information about the cfe-commits
mailing list