Author: Nathan Corbyn
Date: 2026-07-06T17:48:00Z
New Revision: 82d27f67b6aad3bf72e9db610ab5b6984cb02b76

URL: 
https://github.com/llvm/llvm-project/commit/82d27f67b6aad3bf72e9db610ab5b6984cb02b76
DIFF: 
https://github.com/llvm/llvm-project/commit/82d27f67b6aad3bf72e9db610ab5b6984cb02b76.diff

LOG: Revert "[ORC] Track __emutls_t definitions in IRMaterializationUnit" 
(#207775)

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/Orc/Layer.cpp

Removed: 
    clang/test/Interpreter/emulated-tls.cpp


################################################################################
diff  --git a/clang/test/Interpreter/emulated-tls.cpp 
b/clang/test/Interpreter/emulated-tls.cpp
deleted file mode 100644
index 73afe172ef6d9..0000000000000
--- a/clang/test/Interpreter/emulated-tls.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-// REQUIRES: host-supports-jit
-// UNSUPPORTED: system-windows
-//
-// An inline function that odr-uses a non-zero-initialized thread_local is
-// emitted as a weak (linkonce_odr) definition into every 
PartialTranslationUnit
-// that references it. With emulated TLS that set includes an __emutls_t.<var>
-// symbol. When a later PTU re-defines the same weak set, ORC's
-// IRMaterializationUnit::discard() must find each duplicated symbol in its
-// SymbolToDefinition map. The emulated-TLS path used to register 
__emutls_t.<var>
-// in SymbolFlags but not SymbolToDefinition, so discarding it dereferenced
-// end() -- an assertion failure in +Asserts builds and heap corruption
-// otherwise. Two PTUs each pulling in the same inline worker reproduces it.
-//
-// RUN: cat %s | clang-repl | FileCheck %s
-
-extern "C" int printf(const char *, ...);
-template <int Tag> struct HeavyThing { static thread_local int tls; };
-template <int Tag> thread_local int HeavyThing<Tag>::tls = Tag + 1;
-inline int worker() { return HeavyThing<1>::tls; }
-int callA() { return worker(); }
-int callB() { return worker(); }
-auto r = printf("tls = %d, %d\n", callA(), callB());
-// CHECK: tls = 2, 2
-
-%quit

diff  --git a/llvm/lib/ExecutionEngine/Orc/Layer.cpp 
b/llvm/lib/ExecutionEngine/Orc/Layer.cpp
index 5e95b8c73b482..eb144275da589 100644
--- a/llvm/lib/ExecutionEngine/Orc/Layer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Layer.cpp
@@ -70,7 +70,6 @@ IRMaterializationUnit::IRMaterializationUnit(
 
           auto EmuTLST = Mangle(("__emutls_t." + GV.getName()).str());
           SymbolFlags[EmuTLST] = Flags;
-          SymbolToDefinition[EmuTLST] = &GV;
         }
         continue;
       }


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to