<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Nov 5, 2013 at 1:37 PM, Rafael Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank" class="cremed">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Tue Nov  5 15:37:29 2013<br>
New Revision: 194095<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=194095&view=rev" target="_blank" class="cremed">http://llvm.org/viewvc/llvm-project?rev=194095&view=rev</a><br>
Log:<br>
Produce direct calls instead of alias to linkonce_odr functions.<br></blockquote><div><br></div><div>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:</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-    // In addition to making sure we produce it in every TU, we have to make<br>
-    // sure llvm keeps it.<br></blockquote><div><br></div><div>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...)</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-    // FIXME: Instead of outputting an alias we could just replace every use of<br>
-    // AliasDecl with TargetDecl.<br>
-    assert(Linkage == TargetLinkage);<br>
-    Linkage = llvm::GlobalValue::WeakODRLinkage;<br></blockquote><div><br></div><div>And yet the code that replaces this:</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    // Instead of creating as alias to a linkonce_odr, replace all of the uses<br>
+    // of the aliassee.<br>
+    if (TargetLinkage == llvm::GlobalValue::LinkOnceODRLinkage) {<br>
+      Replacements[MangledName] = Aliasee;<br>
+      return false;<br>
+    }<br></blockquote><div><br></div><div>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.</div><div><br>
</div><div>So, what's going on here? Any ideas? Hopefully Nick can add a test case when the reduction finishes.</div></div></div></div>