[PATCH] Improve performance of lazy linking in llvm-link

James Molloy James.Molloy at arm.com
Wed Mar 27 02:07:20 PDT 2013


Hi Renato,

Thanks for the very quick review! Your understanding of what the patch
does is entirely correct.


> However, I don't see where it would create the original prototype (on
> removed code), which makes me question my assumptions of your change.
>
This is in the second hunk:

+  // If the function is to be lazily linked, don't create it just yet.
+  // Instead, remember its current set of uses to diff against later.
+  if (!DGV && (SF->hasLocalLinkage() || SF->hasLinkOnceLinkage() ||
+               SF->hasAvailableExternallyLinkage())) {
+    LazyLinkEntry LLE;
+    LLE.Fn = SF;
+    LLE.Uses.insert(SF->use_begin(), SF->use_end());
+    LazilyLinkFunctions.push_back(LLE);
+    DoNotLinkFromSource.insert(SF);
+    return false;
+  }
+
   // If there is no linkage to be performed or we are linking from the
source,
   // bring SF over.
   Function *NewDF =
Function::Create(TypeMap.get(SF->getFunctionType()),

The last context line is where the function prototype gets created. Now,
we return false before that so it doesn't get executed.

Were there any other issues with the patch, or is it good to commit?

Cheers,

James

On Tue, 2013-03-26 at 21:24 +0000, Renato Golin wrote:
> Hi James,
>
>
> I'm not an expert in the Linker, but this patch looks good.
>
>
> If I understood correctly, the current code is not entirely lazy, but
> adds the prototype and removes back again if no changes. And the speed
> up is that you check for the current use versus the original use and
> only create the prototype in case it did. I can see you're not erasing
> from the parent (because it was never added in the first place, I
> assume), so that's another speed up.
>
>
> However, I don't see where it would create the original prototype (on
> removed code), which makes me question my assumptions of your change.
>
>
> cheers,
> --renato


-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.




More information about the llvm-commits mailing list