<div dir="ltr">On 28 October 2013 19:56, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Ping.<br></blockquote><div><br></div><div><div>-      if (Linkage != GlobalValue::LinkOnceODRAutoHideLinkage)</div>

<div>+</div><div>+      bool CanBeHidden = Linkage == GlobalValue::LinkOnceODRAutoHideLinkage;</div><div>+</div><div>+      if (!CanBeHidden && Linkage == GlobalValue::LinkOnceODRLinkage) {</div><div>+        if (GV->hasUnnamedAddr()) {</div>

<div>+          CanBeHidden = true;</div><div>+        } else {</div><div>+          GlobalStatus GS;</div><div>+          if (!GlobalStatus::analyzeGlobal(GV, GS) && !GS.IsCompared)</div><div><br></div><div>Ah, really? Put another way, why should we pay this penalty *here*? This is something we can compute in the mid-level optimizer and should compute in the mid-level optimizer, and we shouldn't waste our time second-guessing it here.</div>

<div><br></div><div>I assume the real problem is that we don't do a second run of globalopt at the end of the TU to mark more things with unnamed_addr? How much do we lose if you don't do this recomparison, is that tolerable? I realize that getting a second run of globalopt at the end is going to be time consuming to prove worthwhile, but I really think it's the right way to go.</div>

<div><br></div><div>+            CanBeHidden = true;<br></div><div>+        }</div><div>+      }</div><div>+</div><div>+      if (!CanBeHidden)</div></div><div><br></div><div>Everything else about the patch LGTM.</div><div>

<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I just tested this with the linker in Xcode 5 and the results are:<br>


<br>
$ nm  build-with-master/bin/clang-3.4  | grep  ' T ' | wc<br>
<br>
   <a href="tel:21053%20%20%2063159" value="+12105363159">21053   63159</a> 1790901<br>
<br>
$ nm  build-with-patch/bin/clang-3.4  | grep  ' T ' | wc<br>
<br>
   19049   57147 1547425<br></blockquote><div><br></div><div>Nice!!</div><div><br></div><div>Nick</div><div><br></div></div><br></div></div>