[clang] [CIR] Implement destruction of TLS and static global references (PR #200227)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 1 11:56:24 PDT 2026


================
@@ -1597,16 +1597,19 @@ void LoweringPreparePass::lowerGlobalOp(GlobalOp op) {
       // a guard variable for them (since they cannot use the global guard), so
       // we differentiate them that way.
 
-      if (op.getDynTlsRefs()->getGuardName()) {
+      // Some TLS globals (e.g. internal-linkage lifetime-extended reference
+      // temporaries) have no wrapper at all, so there are no dyn_tls_refs to
+      // associate them with. They still need to participate in the ordered
+      // __tls_init flow, but no wrapper alias is required.
+      if (op.getDynTlsRefs() && op.getDynTlsRefs()->getGuardName()) {
----------------
erichkeane wrote:

oh wait, are these checks still needed?  Since these special DynTlsRefs only exist if there is a ctor/dtor, we should keep the rules of "if you have a ctor and are TLS, you NEED the DynTlsREfs.

I think you can revert this whole file.

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


More information about the cfe-commits mailing list