[llvm] [WebAssembly] Remove threadlocal.address when disabling TLS (PR #88209)

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 10 10:29:20 PDT 2024


================
@@ -289,6 +289,19 @@ class CoalesceFeaturesAndStripAtomics final : public ModulePass {
 
   bool stripThreadLocals(Module &M) {
     bool Stripped = false;
+    for (auto &F : M) {
+      for (auto &B : F) {
+        for (auto &I : make_early_inc_range(B)) {
+          if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(&I)) {
+            if (II->getIntrinsicID() == Intrinsic::threadlocal_address) {
+              II->replaceAllUsesWith(II->getArgOperand(0));
+              II->eraseFromParent();
+              Stripped = true;
+            }
+          }
+        }
+      }
+    }
     for (auto &GV : M.globals()) {
       if (GV.isThreadLocal()) {
----------------
MatzeB wrote:

yep, changed

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


More information about the llvm-commits mailing list