r194095 - Produce direct calls instead of alias to linkonce_odr functions.

Chandler Carruth chandlerc at google.com
Tue Nov 12 03:41:32 PST 2013


On Tue, Nov 5, 2013 at 1:37 PM, Rafael Espindola <rafael.espindola at gmail.com
> wrote:

> Author: rafael
> Date: Tue Nov  5 15:37:29 2013
> New Revision: 194095
>
> URL: http://llvm.org/viewvc/llvm-project?rev=194095&view=rev
> Log:
> Produce direct calls instead of alias to linkonce_odr functions.
>

Rafael, I really can't figure out why this is a valid thing to do here or
in the other patch where you've made this change. See below. Maybe I'm
missing something, but we have link errors in complex C++ template code all
tracing back to this commit. Nick is still working on a test case to help
clarify, but the code seems somewhat straight forward:

-    // In addition to making sure we produce it in every TU, we have to
> make
> -    // sure llvm keeps it.
>

This comment ^^^ seems to very clearly indicate that there is a need for
other TUs to be able to reference this alias. (The second part of the
comment that is...)


> -    // FIXME: Instead of outputting an alias we could just replace every
> use of
> -    // AliasDecl with TargetDecl.
> -    assert(Linkage == TargetLinkage);
> -    Linkage = llvm::GlobalValue::WeakODRLinkage;
>

And yet the code that replaces this:

+    // Instead of creating as alias to a linkonce_odr, replace all of the
> uses
> +    // of the aliassee.
> +    if (TargetLinkage == llvm::GlobalValue::LinkOnceODRLinkage) {
> +      Replacements[MangledName] = Aliasee;
> +      return false;
> +    }
>

This doesn't preserve the same set of invariants the code above seems to
indicate are needed: the ability for there to be a weak ODR alias emitted
into this TU.

So, what's going on here? Any ideas? Hopefully Nick can add a test case
when the reduction finishes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131112/9d093c38/attachment.html>


More information about the cfe-commits mailing list