<div>When the SrcReg has the kill flag set, we don't want to propagate that and just keeping the original DstReg kill flag at its last use. Basically there is no work to be done when SrcReg has the kill flag set.</div><div>When the kill flag is not set we have to first clear the kill flag from all DstReg uses and then perform the replacement with the SrcReg. If we would do the clearing of the kill flag afterwards we would clear more kill flags than necessary and perform more work too.<br /><div><br /></div><div>if (!MI->getOperand(1).isKill())</div><div>  MRI->clearKillFlags(DstReg);</div><div>MRI->replaceRegWith(DstReg, SrcReg);</div><div><br /></div><div><font face="Courier New">DstReg<def> = COPY SrcReg<kill>     DstReg<def> = COPY SrcReg</font></div><div><font face="Courier New"><br /></font></div><div><font face="Courier New">... = ... DstReg                    ... = ... DstReg</font></div><div><font face="Courier New">... = ... DstReg<kill>              ... = ... DstReg<kill></font></div><div><font face="Courier New">                                    </font><span style="font-family: 'Courier New';">... = ... SrcReg<kill></span></div><div><font face="Courier New"><br /></font></div><div><font face="Courier New">-----></font></div><div><font face="Courier New"><br /></font></div><div><font face="Courier New">... = ... SrcReg                    </font><span style="font-family: 'Courier New';">... = ... SrcReg</span></div><div><font face="Courier New">... = ... SrcReg<kill>              </font><span style="font-family: 'Courier New';">... = ... SrcReg</span></div><div><span style="font-family: 'Courier New';">                                    </span><font face="Courier New">... = ... SrcReg<kill> <-- this would get cleared too if we clear the kill flags for SrcReg.</font></div><div><br /></div><div><div><span>-Juergen</span></div><div><span><br /></span></div><div><span>On 09/05/14, <b class="name">Quentin Colombet </b> <qcolombet@apple.com> wrote:</span><blockquote cite="mid:79E853C4-9C5F-41CA-8CCB-E8C5AB032053@apple.com" class="iwcQuote" style="border-left: 1px solid #00F; padding-left: 13px; margin-left: 0;" type="cite"><div class="mimepart text html"><span><p><meta content="text/html charset=windows-1252" http-equiv="Content-Type" /><table><tbody><tr><td style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><p><br /></p><div><div>On Sep 5, 2014, at 10:35 AM, Quentin Colombet <<a href="mailto:qcolombet@apple.com">qcolombet@apple.com</a>> wrote:</div><br class="Apple-interchange-newline" /><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><br class="Apple-interchange-newline" />On Sep 5, 2014, at 10:21 AM, Juergen Ributzka <<a href="mailto:juergen@apple.com">juergen@apple.com</a>> wrote:</div><br class="Apple-interchange-newline" /><blockquote type="cite">clearKillFlags seems a little "overkill" to me. In this case you could just simply transfer the value of the kill flag from the SrcReg to the DstReg.</blockquote><div><br /></div><div>We are extending the live-range of SrcReg. I do not see how you could relate that to the kill flag of DstReg.</div></div></blockquote><div><br /></div><div>I mean, we *may* extend, but we do not really know.</div><br /><blockquote type="cite"><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div><br /></div><div>Therefore, I still think, this is the right fix.</div><div><br /></div><div>-Quentin</div><br /><blockquote type="cite"><div><br /></div><div>-Juergen<br /><br /><span>On 09/05/14,<b class="name">Quentin Colombet</b><<a href="mailto:qcolombet@apple.com">qcolombet@apple.com</a>> wrote:</span><blockquote cite="mid:25C90F09-8351-42FE-8761-4F890DB09A05@apple.com" class="iwcQuote" style="border-left-width: 1px; border-left-style: solid; border-left-color: rgb(0, 0, 255); padding-left: 13px; margin-left: 0px;" type="cite"><div class="mimepart text html"><span><p><table><tbody><tr><td style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><p>Hi Patrik,</p><div><br /></div><div>LGTM.</div><div><br /></div><div>Thanks,</div><div>-Quentin<br /><div><div>On Sep 5, 2014, at 1:03 AM, Patrik Hägglund H <<a href="mailto:patrik.h.hagglund@ericsson.com">patrik.h.hagglund@ericsson.com</a>> wrote:</div><br class="Apple-interchange-newline" /><blockquote type="cite"><div lang="EN-US" link="blue" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" vlink="purple"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Hi Quentin,<o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Jonas looked further into the problem below, and asked me to submit his patch. Note the we have our own out-of-tree target, and we have not been able to reproduce this problem on an in-tree target. /Patrik<span class="SpellE">Hägglund</span><o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">[<span class="SpellE">MachineSinking</span>] Conservatively clear kill flags after coalescing.<o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">This solves the problem of having a kill flag inside a loop<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">with a definition of the register prior to the loop:<o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">%vreg368<<span class="SpellE">def</span>> ...<o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">Inside loop:<o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><span>       </span>%vreg520<<span class="SpellE">def</span>> = COPY %vreg368<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><span>       </span>%vreg568<def,tied1> = add %vreg341<tied0>, %vreg520<kill><o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">=> was coalesced into =><o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">       </span><span lang="SV" style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">%vreg568<def,tied1> =<span class="SpellE">add</span>%vreg341<tied0>, %vreg368<kill><o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="SpellE"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">MachineVerifier</span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">then complained:<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">*** Bad machine code: Virtual register killed in block, but needed live out. ***<o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">The kill flag for %vreg368 is incorrect, and is cleared by this patch.<o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">This is similar to the clearing done at the end of<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span class="SpellE"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">MachineSinking</span></span><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">::<span class="SpellE">SinkInstruction</span>().<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">---<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">lib/<span class="SpellE">CodeGen</span>/MachineSink.cpp | 5 +++++<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">1 file changed, 5 insertions(+)<o:p></o:p></span></div><div><br /></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">diff --<span class="SpellE">git</span>a/lib/<span class="SpellE">CodeGen</span>/MachineSink.cpp b/lib/<span class="SpellE">CodeGen</span>/MachineSink.cpp<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">index 7782001..261af54 100644<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">--- a/lib/<span class="SpellE">CodeGen</span>/MachineSink.cpp<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">+++ b/lib/<span class="SpellE">CodeGen</span>/MachineSink.cpp<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">@@ -157,6 +157,11 @@<span class="SpellE">bool</span><span class="SpellE">MachineSinking</span>::<span class="SpellE">PerformTrivialForwardCoalescing</span>(<span class="SpellE">MachineInstr</span>*MI,<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><span>  </span>DEBUG(<span class="SpellE">dbgs</span>() << "*** to: " << *MI);<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><span>  </span>MRI-><span class="SpellE">replaceRegWith</span>(<span class="SpellE">DstReg</span>,<span class="SpellE">SrcReg</span>);<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><span>  </span>MI-><span class="SpellE">eraseFromParent</span>();<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">+<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">+// Conservatively, clear any kill flags, since it's possible that they are no<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">+// longer correct.<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">+MRI-><span class="SpellE">clearKillFlags</span>(<span class="SpellE">SrcReg</span>);<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">+<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><span>  </span>++<span class="SpellE">NumCoalesces</span>;<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><span>  </span>return true;<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">}<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">--<o:p></o:p></span></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);">2.1.0<o:p></o:p></span></div><div><br /></div><div><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0cm 0cm;"><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;"><a href="mailto:llvmdev-bounces@cs.uiuc.edu" style="color: purple; text-decoration: underline;">llvmdev-bounces@cs.uiuc.edu</a>[<a href="mailto:llvmdev-bounces@cs.uiuc.edu" style="color: purple; text-decoration: underline;">mailto:llvmdev-bounces@cs.uiuc.edu</a>]<b>On Behalf Of</b>Quentin Colombet<br /><b>Sent:</b>den 2 september 2014 18:37<br /><b>To:</b>Jonas Paulsson<br /><b>Cc:</b><a href="mailto:llvmdev@cs.uiuc.edu" style="color: purple; text-decoration: underline;">llvmdev@cs.uiuc.edu</a><br /><b>Subject:</b>Re: [LLVMdev] Machine code sinking pass<o:p></o:p></span></div></div></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><o:p> </o:p></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span>Hi Jonas,<o:p></o:p></span></div><div><br /></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span>This looks like a bug in Machine code sinking pass.<o:p></o:p></span></div></div><div><br /></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span>Please file a PR on<a href="http://llvm.org/bugs" style="color: purple; text-decoration: underline;" target="1">llvm.org/bugs</a>with a reduced test case to keep track of the issue.<o:p></o:p></span></div></div><div><br /></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span>Thanks,<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span>-Quentin<o:p></o:p></span></div></div><div><div><br /></div><div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span>On Sep 2, 2014, at 5:57 AM, Jonas Paulsson <<a href="mailto:jonas.paulsson@ericsson.com" style="color: purple; text-decoration: underline;">jonas.paulsson@ericsson.com</a>> wrote:<o:p></o:p></span></div></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span><br /><br /><o:p></o:p></span></div><div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="SV" style="font-size: 11pt; font-family: Calibri, sans-serif;">Hi,</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">I ran into MachineVerifier ”Virtual register killed in block, but needed live out.”<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">It was MachineSinking:PerformTrivialForwardCoalescing() that coalesced a COPY inside a single-block loop, but left the<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">kill-flag and then MachineVerifier complains that a register in vregsRequired is killed in MBB.<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">In the example, %vreg520 is replaced by %vreg368 by PerformTrivialForwardCoalescing(), without clearing the kill flag:<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">BB#13: derived from LLVM BB %CF250</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">    Predecessors according to CFG: BB#12 BB#13 BB#14</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="SV" style="font-size: 11pt; font-family: 'Courier New';">       …</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="SV" style="font-size: 11pt; font-family: 'Courier New';">        %vreg520<def> = COPY %vreg368</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="SV" style="font-size: 11pt; font-family: 'Courier New';">        %vreg568<def,tied1> = cmp %vreg341<tied0>, %vreg520<kill></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="SV" style="font-size: 11pt; font-family: 'Courier New';">       </span><span style="font-size: 11pt; font-family: 'Courier New';">brr_cond <BB#13></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">        brr_uncond <BB#14></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">    Successors according to CFG: BB#13, BB#14</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">Into<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">BB#13: derived from LLVM BB %CF250</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">    Predecessors according to CFG: BB#12 BB#13 BB#14</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="SV" style="font-size: 11pt; font-family: 'Courier New';">        …</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="SV" style="font-size: 11pt; font-family: 'Courier New';">        %vreg568<def,tied1> = cmp %vreg341<tied0>, %vreg368<kill></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span lang="SV" style="font-size: 11pt; font-family: 'Courier New';">       </span><span style="font-size: 11pt; font-family: 'Courier New';">brr_cond <BB#13></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">        brr_uncond <BB#14></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">=></span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">*** Bad machine code: Virtual register killed in block, but needed live out. ***</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">- function:    autogen_SD15028</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">- basic block: BB#13 CF250 (0x1c75890)</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: 'Courier New';">Virtual register %vreg368 is used after the block.</span><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"><o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">There is only one use of %vreg368 in the function.<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">One thing that strikes me is that one might want to clear the kill flag for a use inside a loop of a register defined prior to<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">the loop?<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">Best regards,<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;">Jonas Paulsson<o:p></o:p></span></div></div><div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></span></div></div><div style="margin: 0cm 0cm 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;"><span style="font-size: 9pt; font-family: Helvetica, sans-serif;">_______________________________________________<br />LLVM Developers mailing list<br /><a href="mailto:LLVMdev@cs.uiuc.edu" style="color: purple; text-decoration: underline;"><span style="color: purple;">LLVMdev@cs.uiuc.edu</span></a>        <a href="http://llvm.cs.uiuc.edu/" style="color: purple; text-decoration: underline;" target="1"><span style="color: purple;">http://llvm.cs.uiuc.edu</span></a><br /><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" style="color: purple; text-decoration: underline;" target="1"><span style="color: purple;">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</span></a><o:p></o:p></span></div></div></div><div><br /></div></div></div><span><0001-MachineSinking-Conservatively-clear-kill-flags-after.patch></span></div></blockquote></div><br /></div></td></tr></tbody></table></p></span></div></blockquote></div></blockquote></div><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" /><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" /><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">llvm-commits mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" /><a href="mailto:llvm-commits@cs.uiuc.edu" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">llvm-commits@cs.uiuc.edu</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" /><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" target="1">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></blockquote></div><br /></td></tr></tbody></table></p></span></div></blockquote></div></div></div>