[PATCH] D17992: Materialize metadata in IRLinker before value mapping

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 10:07:41 PST 2016


I am not sure this is better than just forcing the client to be non-lazy.

Cheers,
Rafael
On Mar 9, 2016 10:30 AM, "Teresa Johnson" <tejohnson at google.com> wrote:

> tejohnson created this revision.
> tejohnson added a reviewer: rafael.
> tejohnson added subscribers: llvm-commits, silvas.
>
> Unless we plan to do later postpass metadata linking (ThinLTO special
> mode),
> always invoke metadata materialization at the start of IRLinker::run().
> This avoids the need for clients who use lazy metadata loading to
> explicitly invoke materializeMetadata before the IRMover, which in
> turn invokes IRLinker::run and needs materialized metadata for mapping.
>
> Came up in the context of an LLD issue (D17982).
>
> http://reviews.llvm.org/D17992
>
> Files:
>   lib/Linker/IRMover.cpp
>
> Index: lib/Linker/IRMover.cpp
> ===================================================================
> --- lib/Linker/IRMover.cpp
> +++ lib/Linker/IRMover.cpp
> @@ -1492,6 +1492,11 @@
>  }
>
>  bool IRLinker::run() {
> +  // Ensure metadata materialized before value mapping.
> +  if (shouldLinkMetadata() && SrcM->getMaterializer())
> +    if (SrcM->getMaterializer()->materializeMetadata())
> +      return true;
> +
>    // Inherit the target data from the source module if the destination
> module
>    // doesn't have one already.
>    if (DstM.getDataLayout().isDefault())
> @@ -1559,13 +1564,9 @@
>      // Even if just linking metadata we should link decls above in case
>      // any are referenced by metadata. IRLinker::shouldLink ensures that
>      // we don't actually link anything from source.
> -    if (IsMetadataLinkingPostpass) {
> -      // Ensure metadata materialized
> -      if (SrcM->getMaterializer()->materializeMetadata())
> -        return true;
> +    if (IsMetadataLinkingPostpass)
>        SrcM->getMaterializer()->saveMetadataList(MetadataToIDs,
>                                                  /* OnlyTempMD = */ false);
> -    }
>
>      linkNamedMDNodes();
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160309/e0da1a7a/attachment.html>


More information about the llvm-commits mailing list