<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Duncan,<div><br></div><div>Does it mean that the current behavior of global merge is wrong or is this unnamed_addr marker apply only to global constants?</div><div><br></div><div>Anyway, thanks for the information.</div><div><br></div><div><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">-Quentin</div>

</div>
<br><div><div>On Feb 27, 2013, at 12:50 AM, Duncan Sands <<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Quentin, you should only be merging them if they are marked with<br>unnamed_addr (this indicates that no-one is expecting the globals<br>to have distinct addressses).  As EH type infos shouldn't get<br>unnamed_addr, that should mean that the EH issue isn't a problem any<br>more.<br><br>Ciao, Duncan.<br><br><blockquote type="cite">You will find enclosed a patch that adds the support of constant variables for<br>the generic global merge pass.<br>I've also attached a motivating example, test.c.<br><br>In that file there are several global variables accessed within the same function.<br>If all the variables are non-const, global merge generates one unique variable,<br>which translates into one unique load in the assembly file.<br><br>clang -arch arm -O3 test.c -o - -S<br><br>If some are const (the example is very stupid), global merge does not merge<br>anything and one load for each variable is issued, i.e., 3<br>clang -arch arm -O3 test.c -o - -S -DWITHCONST<br><br>If global merge had merged the constant globals, only 2 loads would have been<br>issued. The patch allows to do that.<br><br>Although the patch is fairly simple, it was not done before because it seems it<br>was breaking the EH processing (see comment in the original code).<br>Is it still true?<br><br>If yes, how could I reproduce that?<br><br>Note: that the patch disables by default the handling of global constants<br>because the current heuristic may generate worse code. A tuning may be<br>necessary, but it would be done as a second step<br><br>-Quentin<br><br><br><br><br><br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br><br></blockquote><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote></div><br></div></body></html>