[PATCH] D81605: [IR] Add missing GlobalAlias copying of ThreadLocalMode attribute
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 16 20:16:12 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdf9d64ed9c1d: [IR] Add missing GlobalAlias copying of ThreadLocalMode attribute (authored by nextsilicon-itay-bookstein, committed by tejohnson).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81605/new/
https://reviews.llvm.org/D81605
Files:
llvm/lib/IR/Globals.cpp
llvm/test/Linker/Inputs/alias-threadlocal-defs.ll
llvm/test/Linker/alias-threadlocal.ll
Index: llvm/test/Linker/alias-threadlocal.ll
===================================================================
--- /dev/null
+++ llvm/test/Linker/alias-threadlocal.ll
@@ -0,0 +1,9 @@
+; RUN: llvm-link %s %p/Inputs/alias-threadlocal-defs.ll -S -o - | FileCheck %s
+
+; PR46297
+; Verify that linking GlobalAliases preserves the thread_local attribute
+
+; CHECK: @tlsvar1 = thread_local global i32 0, align 4
+; CHECK: @tlsvar2 = hidden thread_local alias i32, i32* @tlsvar1
+
+ at tlsvar2 = external thread_local global i32, align 4
Index: llvm/test/Linker/Inputs/alias-threadlocal-defs.ll
===================================================================
--- /dev/null
+++ llvm/test/Linker/Inputs/alias-threadlocal-defs.ll
@@ -0,0 +1,2 @@
+ at tlsvar1 = thread_local global i32 0, align 4
+ at tlsvar2 = hidden thread_local alias i32, i32* @tlsvar1
Index: llvm/lib/IR/Globals.cpp
===================================================================
--- llvm/lib/IR/Globals.cpp
+++ llvm/lib/IR/Globals.cpp
@@ -65,6 +65,7 @@
void GlobalValue::copyAttributesFrom(const GlobalValue *Src) {
setVisibility(Src->getVisibility());
setUnnamedAddr(Src->getUnnamedAddr());
+ setThreadLocalMode(Src->getThreadLocalMode());
setDLLStorageClass(Src->getDLLStorageClass());
setDSOLocal(Src->isDSOLocal());
setPartition(Src->getPartition());
@@ -419,7 +420,6 @@
/// from the GlobalVariable Src to this one.
void GlobalVariable::copyAttributesFrom(const GlobalVariable *Src) {
GlobalObject::copyAttributesFrom(Src);
- setThreadLocalMode(Src->getThreadLocalMode());
setExternallyInitialized(Src->isExternallyInitialized());
setAttributes(Src->getAttributes());
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81605.271267.patch
Type: text/x-patch
Size: 1669 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200617/63a461dc/attachment.bin>
More information about the llvm-commits
mailing list