[llvm] r196300 - Teach the internalize pass to skip dllexported symbols because they could be

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue Dec 3 19:16:34 PST 2013


Thanks!

Could you please add a quick note to the LangRef.html about this?

On 3 December 2013 13:05, Yunzhong Gao
<Yunzhong_Gao at playstation.sony.com> wrote:
> 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
> +}
> +
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list