[clang] [lld] [llvm] [WebAssembly] Cooperative threading for WASIP3 (PR #200855)

Sam Clegg via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 5 09:52:44 PDT 2026


================
@@ -283,10 +283,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]) {
----------------
sbc100 wrote:

Does the the removal of the `else` there change the behaviour in the case we have atomics enabled but not explicitly bulk memory?

https://github.com/llvm/llvm-project/pull/200855


More information about the cfe-commits mailing list