[PATCH] CodeGen: Don't emit a thread-wrapper if we can't touch the backing variable

Richard Smith richard at metafoo.co.uk
Fri Jul 11 13:07:07 PDT 2014


LGTM

================
Comment at: lib/CodeGen/ItaniumCXXABI.cpp:1842-1844
@@ -1832,7 +1841,5 @@
 
-  // All accesses to the thread_local variable go through the thread wrapper.
-  // However, this means that we cannot allow the thread wrapper to get inlined
-  // into any functions.
-  if (VD->getTLSKind() == VarDecl::TLS_Dynamic &&
-      CGM.getTarget().getTriple().isMacOSX())
-    return llvm::GlobalValue::WeakAnyLinkage;
+  // The thread wrapper can't be inlined if the backing variable cannot always
+  // be referenced.  However, the thread wrapper can be replaced by a different
+  // definition in another translation unit.
+  if (isThreadWrapperReplaceable(VD, CGM)) {
----------------
Can you reword this? The reference to inlining doesn't make much sense here. I think we just want to say "If the thread wrapper is replaceable, give it appropriate linkage." -- but even this is kinda obvious from the code.

http://reviews.llvm.org/D4109






More information about the cfe-commits mailing list