<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Nov 18, 2010, at 5:19 AM, Krister Wombell wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div>Q1 (a 128-bit physical register) is assigned to %reg16402 which is ok but then RALinScan::attemptTrivialCoalescing thinks it can coalesce r16405 with r16402 giving:</div><div><br></div><div><font class="Apple-style-span" face="'courier new', monospace">92L<span style="white-space: pre-wrap; ">      </span>Q1:dsub0<def>        = DEF64 %reg16402<imp-def>, QPR:%reg16402</font></div><div><font class="Apple-style-span" face="'courier new', monospace">116L<span style="white-space: pre-wrap; ">      </span>Q1:sub0<def>         = COPY Q1:sub1, %reg16405<imp-def>; QPR:%reg16405,16402</font></div><div><font class="Apple-style-span" face="'courier new', monospace">124L<span style="white-space: pre-wrap; ">        </span>%reg16413:sub0<def>  = COPY Q1:sub0; QPR:%reg16413,16405</font></div><div><font class="Apple-style-span" face="'courier new', monospace">.... stuff ....</font></div><div><font class="Apple-style-span" face="'courier new', monospace">468L<span style="white-space: pre-wrap; ">     </span>%reg16460:sub3<def>  = COPY Q1:sub0<kill>; QPR:%reg16460,16402</font></div><div><br></div><div>which is wrong: Q1:sub0 (in reg16402) is overwitten at 116 before it's last use at 468.</div><div><br></div><div>Trivial coalescing doesn't have any check for subregs so I'm assuming that something is broke. I've patched things up by rejecting any trivial coalescing attempt where the COPY has a subregister as it's target (none of the tests for arm and x86 hit this case).</div><div><br></div><div>Does that seem right?  Not sure if I've misused subregs or if the input to the RA is incorrect?</div></span></blockquote></div><br><div>It looks like you found a bug.</div><div><br></div><div>This code has probably been tested mostly with x86 code where such a sub-register mismatch is not possible.</div><div><br></div><div>The trivial coalescing after allocation is a bit fragile, and I think you are right to disable it when the copy destination is a sub-register.</div><div><br></div><div>Do you have a patch?</div><div><br></div><div>/jakob</div><div><br></div></body></html>