<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="">Thanks both, that’s great!<div class=""><br class=""></div><div class="">If you’re afraid it is too detailed, look at the clang section below ;)</div><div class=""><br class=""></div><div class="">— </div><div class="">Mehdi</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 2, 2017, at 11:14 AM, Robinson, Paul <<a href="mailto:paul.robinson@sony.com" class="">paul.robinson@sony.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; 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;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">I made ABI_BREAKING_CHECKS be its own bullet point, and added advice for how to approach "should not change generated code."  Maybe that's getting too detailed for this document but it could prevent some false starts.<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">--paulr<o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><a name="_MailEndCompose" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""> </o:p></span></a></div><div style="border-style: none none none solid; border-left-width: 1.5pt; border-left-color: blue; padding: 0in 0in 0in 4pt;" class=""><div class=""><div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(181, 196, 223); padding: 3pt 0in 0in;" class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><b class=""><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class="">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;" class=""><span class="Apple-converted-space"> </span>llvm-dev [<a href="mailto:llvm-dev-bounces@lists.llvm.org" class="">mailto:llvm-dev-bounces@lists.llvm.org</a>]<span class="Apple-converted-space"> </span><b class="">On Behalf Of<span class="Apple-converted-space"> </span></b>Matthias Braun via llvm-dev<br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Thursday, February 02, 2017 10:25 AM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Mehdi Amini<br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [llvm-dev] Register allocator behaves differently when compiling with and without -g<o:p class=""></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">On Feb 2, 2017, at 9:38 AM, Mehdi Amini via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" style="color: purple; text-decoration: underline;" class="">llvm-dev@lists.llvm.org</a>> wrote:<o:p class=""></o:p></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div><div class=""><div class=""><blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><br class="">On Feb 2, 2017, at 8:20 AM, David Blaikie via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" style="color: purple; text-decoration: underline;" class="">llvm-dev@lists.llvm.org</a>> wrote:<o:p class=""></o:p></span></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""> </o:p></span></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" 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.<o:p class=""></o:p></span></div></div></div></blockquote><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""> </o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">I added a line there: <a href="https://docs.google.com/document/d/1YLK_xINSg1Ei0w8w39uAMR1n0dlf6wrzfypiX0YDQBc/edit" style="color: purple; text-decoration: underline;" class="">https://docs.google.com/document/d/1YLK_xINSg1Ei0w8w39uAMR1n0dlf6wrzfypiX0YDQBc/edit#</a><o:p class=""></o:p></span></div></div></div></div></blockquote><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">Seeing that doc I also added a sentence that ENABLE_ABI_BREAKING_CHECKS (= different iteration order for hashsets) should not change code generation.<o:p class=""></o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><o:p class=""> </o:p></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">- Matthias<o:p class=""></o:p></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><br class=""><br class=""><o:p class=""></o:p></div><div class=""><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""> </o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">— <o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">Mehdi<o:p class=""></o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""> </o:p></span></div></div><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""> </o:p></span></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><br class=""><br class=""><o:p class=""></o:p></span></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""> </o:p></span></div><div class=""><div class=""><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">On Thu, Feb 2, 2017 at 8:18 AM Stephen Rogers via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" style="color: purple; text-decoration: underline;" class="">llvm-dev@lists.llvm.org</a>> wrote:<o:p class=""></o:p></span></div></div><blockquote style="border-style: none none none solid; border-left-width: 1pt; border-left-color: rgb(204, 204, 204); padding: 0in 0in 0in 6pt; margin-left: 4.8pt; margin-right: 0in;" class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><div class=""><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">Hi all,<o:p class=""></o:p></span></p></div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">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><span class="gmailmsg"><span style="font-size: 9pt; font-family: 'Courier New';" class="">DBG_VALUE</span></span><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">" 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=""></span><span style="font-size: 9pt; font-family: 'Courier New';" class=""><br class=""><span class="gmailmsg">32B        %vreg29<def> = LDImm 1; REG1:%vreg29</span><br class=""><span class="gmailmsg">36B        %vreg44<def> =</span><span class="apple-converted-space"> </span><span class="gmailmsg">LDImm</span><span class="apple-converted-space"> </span><span class="gmailmsg">1103515245; REG1:%vreg44</span><br class=""><span class="gmailmsg">40B        %vreg143:vsub32_1<def,read-undef> = LDImm 0; REG2:%vreg143</span><br class=""><span class="gmailmsg">44B        %vreg68<def> =</span><span class="apple-converted-space"> </span><span class="gmailmsg">LDImm</span><span class="apple-converted-space"> </span><span class="gmailmsg">12345; REG1:%vreg68</span><br class=""><span class="gmailmsg">64B        %vreg143:vsub32_0<def> = COPY %vreg143:vsub32_1; REG2:%vreg143</span><br class=""><span class="gmailmsg">72B        %vreg78<def> =</span><span class="apple-converted-space"> </span><span class="gmailmsg">LDImm</span><span class="apple-converted-space"> </span><span class="gmailmsg">32; REG1:%vreg78</span></span><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""></o:p></span></p></div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="gmailmsg"><span style="font-size: 9pt; font-family: Arial, sans-serif;" class="">But when I specify -g, this becomes:</span></span><span style="font-size: 9pt; font-family: Arial, sans-serif;" class=""><br class=""><br class=""></span><span class="gmailmsg"><span style="font-size: 9pt; font-family: 'Courier New';" class="">32B        %vreg29<def> =</span></span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: 'Courier New';" class=""> </span></span><span class="gmailmsg"><span style="font-size: 9pt; font-family: 'Courier New';" class="">LDImm</span></span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: 'Courier New';" class=""> </span></span><span class="gmailmsg"><span style="font-size: 9pt; font-family: 'Courier New';" class="">1;</span></span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: 'Courier New';" class=""> </span></span><span class="gmailmsg"><span style="font-size: 9pt; font-family: 'Courier New';" class="">REG1:%vreg29 dbg:path/to/source:9:34 @[</span></span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: 'Courier New';" class=""> </span></span><span class="gmailmsg"><span style="font-size: 9pt; font-family: 'Courier New';" class="">path/to/source:25:13 ]</span></span><span style="font-size: 9pt; font-family: 'Courier New';" class=""><br class=""><span class="gmailmsg">36B        %vreg44<def> =</span><span class="apple-converted-space"> </span><span class="gmailmsg">LDImm</span><span class="apple-converted-space"> </span><span class="gmailmsg">1103515245;</span><span class="apple-converted-space"> </span><span class="gmailmsg">REG1:%vreg44 dbg:path/to/source:9:34 @[ path/to/source:25:13 ]</span><br class=""><span class="gmailmsg"><span style="color: red; background-color: white; background-position: initial initial; background-repeat: initial initial;" class="">44B</span>        %vreg143:vsub32_1<def,read-undef> =</span><span class="apple-converted-space"> </span><span class="gmailmsg">LDImm</span><span class="apple-converted-space"> </span><span class="gmailmsg">0;</span><span class="apple-converted-space"> </span><span class="gmailmsg">REG2:%vreg143</span><br class=""><span class="gmailmsg"><span style="color: red;" class="">48B</span>        %vreg68<def> =</span><span class="apple-converted-space"> </span><span class="gmailmsg">LDImm</span><span class="apple-converted-space"> </span><span class="gmailmsg">12345;</span><span class="apple-converted-space"> </span><span class="gmailmsg">REG1:%vreg68 dbg:path/to/source:9:47 @[</span><span class="apple-converted-space"> </span><span class="gmailmsg">path/to/source:25:13 ]</span><br class=""><span class="gmailmsg"><span style="color: red;" class="">56B</span>        %vreg143:vsub32_0<def> = COPY %vreg143:vsub32_1;</span><span class="apple-converted-space"> </span><span class="gmailmsg">REG2:%vreg143</span><br class=""><span class="gmailmsg"><span style="color: red;" class="">60B</span>        %vreg78<def> =</span><span class="apple-converted-space"> </span><span class="gmailmsg">LDImm</span><span class="apple-converted-space"> </span><span class="gmailmsg">32;</span><span class="apple-converted-space"> </span><span class="gmailmsg">REG1:%vreg78</span></span><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""></o:p></span></p></div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="gmailmsg"><span style="font-size: 9pt; font-family: Arial, sans-serif;" class="">This change seems to affect the weight assigned to the</span></span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Arial, sans-serif;" class=""> </span></span><span class="gmailmsg"><span style="font-size: 9pt; font-family: 'Courier New';" class="">LiveIntervals</span></span><span class="apple-converted-space"><span style="font-size: 9pt; font-family: Arial, sans-serif;" class=""> </span></span><span class="gmailmsg"><span style="font-size: 9pt; font-family: Arial, sans-serif;" class="">for each virtual register which in turn changes the allocation order.</span></span><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""></o:p></span></p></div><p class="MsoNormal" style="margin: 0in 0in 12pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="gmailmsg"><span style="font-size: 9pt; font-family: Arial, sans-serif;" class="">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?</span></span><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""></o:p></span></p></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span class="gmailmsg"><span style="font-size: 9pt; font-family: Arial, sans-serif;" class="">Thanks,</span></span><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""></o:p></span></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span class="gmailmsg"><span style="font-size: 9pt; font-family: Arial, sans-serif;" class="">Stephen</span></span><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><o:p class=""></o:p></span></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" target="_blank" style="color: purple; text-decoration: underline;" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank" style="color: purple; text-decoration: underline;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p class=""></o:p></span></div></blockquote></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" style="color: purple; text-decoration: underline;" class="">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="color: purple; text-decoration: underline;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><o:p class=""></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""></span><a href="mailto:llvm-dev@lists.llvm.org" style="color: purple; text-decoration: underline;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">llvm-dev@lists.llvm.org</span></a><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class=""><br class=""></span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" style="color: purple; text-decoration: underline;" class=""><span style="font-size: 9pt; font-family: Helvetica, sans-serif;" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</span></a></div></div></div></div></div></div></blockquote></div><br class=""></div></body></html>