<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 2, 2017, at 9:38 AM, Mehdi Amini via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Feb 2, 2017, at 8:20 AM, David Blaikie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">The goal/intent is that debug info does not affect code generation. There are (many?) bugs. I think Apple folks (cc'd Adrian) may be looking at this a bit recently, not sure.<br class=""><br class="">The fixes aren't usually too invasive (usually involve something counting instructions where it needs to skip counting debug intrinsics), if you're interested in having a go at fixing it yourself & sending a patch for review.<br class=""></div></div></blockquote><div class=""><br class=""></div><div class="">I added a line there: <a href="https://docs.google.com/document/d/1YLK_xINSg1Ei0w8w39uAMR1n0dlf6wrzfypiX0YDQBc/edit#" class="">https://docs.google.com/document/d/1YLK_xINSg1Ei0w8w39uAMR1n0dlf6wrzfypiX0YDQBc/edit#</a></div></div></div></blockquote><div>Seeing that doc I also added a sentence that ENABLE_ABI_BREAKING_CHECKS (= different iteration order for hashsets) should not change code generation.</div><div><br class=""></div><div>- Matthias</div><br class=""><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class=""><br class=""></div><div class="">— </div><div class="">Mehdi</div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Feb 2, 2017 at 8:18 AM Stephen Rogers via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg"><div class="gmail_msg">Hi all,<br class="gmail_msg"><br class="gmail_msg"></div>In several of our tests, I have noticed that the register allocator allocates to virtual registers in a different order when compiling with the clang option -g. Before entering the register allocator, the code is identical when compiling with and without -g (with the exception of "<span class="gmail_msg" style="font-family: monospace, monospace;">DBG_VALUE</span>" instructions). The only difference I can see is the value assigned to the slot index for each instruction. As an example, without -g a snippet of a basic block looks like this:<br class="gmail_msg"><span class="gmail_msg" style="font-family: monospace, monospace;"><br class="gmail_msg">32B        %vreg29<def> = LDImm 1; REG1:%vreg29<br class="gmail_msg">36B        %vreg44<def> =<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;">LDImm<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;">1103515245; REG1:%vreg44<br class="gmail_msg">40B        %vreg143:vsub32_1<def,read-undef> = LDImm 0; REG2:%vreg143<br class="gmail_msg">44B        %vreg68<def> =<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">LDImm<span class="Apple-converted-space"> </span></span>12345; REG1:%vreg68<br class="gmail_msg">64B        %vreg143:vsub32_0<def> = COPY %vreg143:vsub32_1; REG2:%vreg143<br class="gmail_msg">72B        %vreg78<def> =<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">LDImm<span class="Apple-converted-space"> </span></span>32; REG1:%vreg78<br class="gmail_msg"><br class="gmail_msg"></span></div><span class="gmail_msg" style="font-family: monospace, monospace;"><font face="arial,helvetica,sans-serif" class="gmail_msg">But when I specify -g, this becomes:<br class="gmail_msg"><br class="gmail_msg"></font>32B        %vreg29<def> =<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;">LDImm<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;">1;<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">REG1</span>:%vreg29 dbg:</span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">path/to/source</span>:9:34 @[<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">path/to/source</span>:25:13 ]<br class="gmail_msg">36B        %vreg44<def> =<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;">LDImm<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;">1103515245;<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">REG1</span>:%vreg44 dbg:path/to/source:9:34 @[ path/to/source:25:13 ]<br class="gmail_msg"><span class="gmail_msg" style="color: rgb(255, 0, 0);"><span class="gmail_msg" style="background-color: rgb(255, 255, 255);">44B</span></span>        %vreg143:vsub32_1<def,read-undef> =<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">LDImm<span class="Apple-converted-space"> </span></span>0;<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">REG2</span>:%vreg143<br class="gmail_msg"><span class="gmail_msg" style="color: rgb(255, 0, 0);">48B</span>        %vreg68<def> =<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;">LDImm<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;">12345;<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">REG1</span>:%vreg68 dbg:</span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">path/to/source</span>:9:47 @[<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">path/to/source</span>:25:13 ]<br class="gmail_msg"><span class="gmail_msg" style="color: rgb(255, 0, 0);">56B</span>        %vreg143:vsub32_0<def> = COPY %vreg143:vsub32_1;<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">REG2</span>:%vreg143<br class="gmail_msg"><span class="gmail_msg" style="color: rgb(255, 0, 0);">60B</span>        %vreg78<def> =<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;">LDImm<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;">32;<span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><span class="gmail_msg" style="font-family: monospace, monospace;">REG1</span>:%vreg78<font face="arial,helvetica,sans-serif" class="gmail_msg"><br class="gmail_msg"><br class="gmail_msg"></font></span></div><span class="gmail_msg" style="font-family: monospace, monospace;"><font face="arial,helvetica,sans-serif" class="gmail_msg">This change seems to affect the weight assigned to the<span class="Apple-converted-space"> </span></font>LiveIntervals</span><span class="gmail_msg" style="font-family: arial, helvetica, sans-serif;"><span class="Apple-converted-space"> </span></span><span class="gmail_msg" style="font-family: monospace, monospace;"><font face="arial,helvetica,sans-serif" class="gmail_msg">for each virtual register which in turn changes the allocation order.<br class="gmail_msg"><br class="gmail_msg"></font></span></div><span class="gmail_msg" style="font-family: monospace, monospace;"><font face="arial,helvetica,sans-serif" class="gmail_msg">It would be my expectation that LLVM should generate identical code for a source file with and without debug information enabled. Is it possible we are missing some hook in our target backend that would prevent this? Or is this the expected behaviour in LLVM?<br class="gmail_msg"><br class="gmail_msg"></font></span></div><span class="gmail_msg" style="font-family: monospace, monospace;"><font face="arial,helvetica,sans-serif" class="gmail_msg">Thanks,<br class="gmail_msg"></font></span></div><span class="gmail_msg" style="font-family: monospace, monospace;"><font face="arial,helvetica,sans-serif" class="gmail_msg">Stephen<br class="gmail_msg"></font></span></div>_______________________________________________<br class="gmail_msg">LLVM Developers mailing list<br class="gmail_msg"><a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="gmail_msg"><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="gmail_msg"></blockquote></div></div>_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class=""></div></blockquote></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">LLVM Developers mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="mailto:llvm-dev@lists.llvm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">llvm-dev@lists.llvm.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></div></blockquote></div><br class=""></body></html>