[PATCH] D74749: ThinLTOBitcodeWriter: drop dso_local when a GlobalVariable is converted to a declaration
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 21 14:48:28 PST 2020
MaskRay updated this revision to Diff 245998.
MaskRay marked 3 inline comments as done.
MaskRay added a comment.
Address comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74749/new/
https://reviews.llvm.org/D74749
Files:
llvm/lib/Transforms/IPO/FunctionImport.cpp
llvm/test/Transforms/ThinLTOBitcodeWriter/split-dsolocal.ll
Index: llvm/test/Transforms/ThinLTOBitcodeWriter/split-dsolocal.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/ThinLTOBitcodeWriter/split-dsolocal.ll
@@ -0,0 +1,15 @@
+; RUN: opt -thinlto-bc -thinlto-split-lto-unit -o %t %s
+; RUN: llvm-modextract -b -n 0 -o %t0.bc %t
+; RUN: llvm-modextract -b -n 1 -o %t1.bc %t
+; RUN: llvm-dis -o - %t0.bc | FileCheck --check-prefix=M0 %s
+; RUN: llvm-dis -o - %t1.bc | FileCheck --check-prefix=M1 %s
+
+; M0: @g = external constant [1 x i8]
+; M1: @g = dso_local constant [1 x i8] c"0", !type !0
+ at g = dso_local constant [1 x i8] c"0", !type !0
+
+define [1 x i8]* @f() {
+ ret [1 x i8]* @g
+}
+
+!0 = !{i32 0, !"typeid"}
Index: llvm/lib/Transforms/IPO/FunctionImport.cpp
===================================================================
--- llvm/lib/Transforms/IPO/FunctionImport.cpp
+++ llvm/lib/Transforms/IPO/FunctionImport.cpp
@@ -992,6 +992,8 @@
GV.replaceAllUsesWith(NewGV);
return false;
}
+ if (!GV.isImplicitDSOLocal())
+ GV.setDSOLocal(false);
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74749.245998.patch
Type: text/x-patch
Size: 1097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200221/6a0e97b8/attachment.bin>
More information about the llvm-commits
mailing list