<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 28, 2009, at 9:39 PM, Chris Lattner wrote:</div><blockquote type="cite"><div>On Oct 28, 2009, at 9:25 PM, Douglas Gregor wrote:<font class="Apple-style-span" color="#540000"><font class="Apple-style-span" color="#144FAE"><br></font></font><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">So, we either need to tie this patch to -fmerge-all-constants (where we allow such non-conforming behavior) or we need to keep track of whether declarations have had their address taken (to implement the equivalent of -fmerge-constants).<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Ok, I think it makes perfect sense to support this.  The question is whether we should default to doing this or not at various optimization levels.<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I'd like to have the behavior of GCC's -fmerge-constants at all optimization levels. We could also support -fmerge-all-constants as an explicit flag, but I don't think that's as important.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">This optimization is a very nice win for common coding patterns, and the LLVM backend isn't "safe" in this respect anyway (it merges 'static' global constants with identical initializers).  How much does it matter?<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">How much does what matter? The optimization? Correctness of the example?<br></blockquote><br>The correctness.  We know that a large amount of code builds with GCC 4.2 (and llvm-gcc for that matter) which do have this misfeature.  Code doesn't actually compare the addresses of different instances of variables from recursive calls and expect them to compare unequal in practice.<br></div></blockquote></div><div><br></div>Meh.<div><br><div>/me places an "I told you so" in has back pocket for safe keeping.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">    </span>- Doug</div></div></body></html>