[llvm] r266893 - ModuleLinker: only import what is in GlobalsToImport, regarless if it is a function or not.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 20 11:32:09 PDT 2016


nice!

On 20 April 2016 at 13:47, Mehdi Amini via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: mehdi_amini
> Date: Wed Apr 20 12:47:42 2016
> New Revision: 266893
>
> URL: http://llvm.org/viewvc/llvm-project?rev=266893&view=rev
> Log:
> ModuleLinker: only import what is in GlobalsToImport, regarless if it is a function or not.
>
> The alias handling was specific to the old iterative inlining
> mechanism, so that is dead now. The variable handling could make a
> difference, since we were previously falling through to the normal
> selection logic, but we don't observe changes in the validation
> because no client seems to rely on it.
>
> Differential Revision: http://reviews.llvm.org/D19307
>
> From: Mehdi Amini <mehdi.amini at apple.com>
>
> Modified:
>     llvm/trunk/lib/Linker/LinkModules.cpp
>
> Modified: llvm/trunk/lib/Linker/LinkModules.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=266893&r1=266892&r2=266893&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Linker/LinkModules.cpp (original)
> +++ llvm/trunk/lib/Linker/LinkModules.cpp Wed Apr 20 12:47:42 2016
> @@ -268,31 +268,15 @@ bool ModuleLinker::shouldLinkFromSource(
>      return false;
>    }
>
> -  bool SrcIsDeclaration = Src.isDeclarationForLinker();
> -  bool DestIsDeclaration = Dest.isDeclarationForLinker();
> -
>    if (isPerformingImport()) {
> -    if (isa<Function>(&Src)) {
> -      // For functions, LinkFromSrc iff this is a function requested
> -      // for importing. For variables, decide below normally.
> -      LinkFromSrc = GlobalsToImport->count(&Src);
> -      return false;
> -    }
> -
> -    // Check if this is an alias with an already existing definition
> -    // in Dest, which must have come from a prior importing pass from
> -    // the same Src module. Unlike imported function and variable
> -    // definitions, which are imported as available_externally and are
> -    // not definitions for the linker, that is not a valid linkage for
> -    // imported aliases which must be definitions. Simply use the existing
> -    // Dest copy.
> -    if (isa<GlobalAlias>(&Src) && !DestIsDeclaration) {
> -      assert(isa<GlobalAlias>(&Dest));
> -      LinkFromSrc = false;
> -      return false;
> -    }
> +    // LinkFromSrc iff this is a global requested for importing.
> +    LinkFromSrc = GlobalsToImport->count(&Src);
> +    return false;
>    }
>
> +  bool SrcIsDeclaration = Src.isDeclarationForLinker();
> +  bool DestIsDeclaration = Dest.isDeclarationForLinker();
> +
>    if (SrcIsDeclaration) {
>      // If Src is external or if both Src & Dest are external..  Just link the
>      // external globals, we aren't adding anything.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list