[llvm] r196300 - Teach the internalize pass to skip dllexported symbols because they could be
Yunzhong Gao
Yunzhong_Gao at playstation.sony.com
Tue Dec 3 10:05:14 PST 2013
Author: ygao
Date: Tue Dec 3 12:05:14 2013
New Revision: 196300
URL: http://llvm.org/viewvc/llvm-project?rev=196300&view=rev
Log:
Teach the internalize pass to skip dllexported symbols because they could be
referenced in a way that even the linker does not see.
Differential Revision: http://llvm-reviews.chandlerc.com/D2280
Modified:
llvm/trunk/lib/Transforms/IPO/Internalize.cpp
llvm/trunk/test/Transforms/Internalize/lists.ll
Modified: llvm/trunk/lib/Transforms/IPO/Internalize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/Internalize.cpp?rev=196300&r1=196299&r2=196300&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/Internalize.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/Internalize.cpp Tue Dec 3 12:05:14 2013
@@ -115,6 +115,10 @@ static bool shouldInternalize(const Glob
if (GV.hasAvailableExternallyLinkage())
return false;
+ // Assume that dllexported symbols are referenced elsewhere
+ if (GV.hasDLLExportLinkage())
+ return false;
+
// Already has internal linkage
if (GV.hasLocalLinkage())
return false;
Modified: llvm/trunk/test/Transforms/Internalize/lists.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Internalize/lists.ll?rev=196300&r1=196299&r2=196300&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Internalize/lists.ll (original)
+++ llvm/trunk/test/Transforms/Internalize/lists.ll Tue Dec 3 12:05:14 2013
@@ -48,3 +48,12 @@ define void @foo() {
define available_externally void @bar() {
ret void
}
+
+; ALL: define dllexport void @export_foo() {
+; FOO_AND_J: define dllexport void @export_foo() {
+; FOO_AND_BAR: define dllexport void @export_foo() {
+; FOO_J_AND_BAR: define dllexport void @export_foo() {
+define dllexport void @export_foo() {
+ ret void
+}
+
More information about the llvm-commits
mailing list