<html><head><base href="x-msg://169/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 24, 2012, at 7:44 AM, Jonas Paulsson 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-align: -webkit-auto; 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><font face="Arial, sans-serif" size="3"><div> </div><div><font size="2">Hi,</font></div><div><font size="2"> </font></div><div><font size="2">I'm having an issue with subregisters on my target.</font></div><div><font size="2"> </font></div><div><font size="2">With a pseudo that writes to a 32 bit reg:</font></div><div><font size="2"> </font></div><div><font size="2">        %vreg20<def> = toHi16_low0_pseudo %vreg2; reg32:%vreg20 hi16:%vreg2</font></div><div><font size="2"> </font></div><div><font size="2">expands to</font></div><div><font size="2"> </font></div><div><font size="2">        %vreg2<def> = COPY %a2h; hi16:%vreg2</font></div><div><font size="2">        %vreg43<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>; lo16:%vreg43</font></div><div><font size="2">        %vreg20<def> = REG_SEQUENCE %vreg2, hi16, %vreg43, lo16; reg32:%vreg20 hi16:%vreg2 lo16:%vreg43</font></div><div><font size="2"> </font></div><div><font size="2">Becomes</font></div><div><font size="2"> </font></div><div><font size="2">16L             %vreg20:hi16<def,undef> = COPY %a2h<kill>, %vreg20<imp-def>; reg32:%vreg20</font></div><div><font size="2">368L            %vreg20:lo16<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>; reg32:%vreg20</font></div><div><font size="2"> </font></div><div><font size="2">Becomes</font></div><div><font size="2"> </font></div><div><font size="2">Live Ins: %a0h %a1_32 %a2h %a3_32</font></div><div><font size="2">        ... (COPY coalesced as a2h is live in)</font></div><div><font size="2">        %a2l<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>, %a2_32<imp-use></font></div><div><font size="2"> </font></div><div><font size="2">results in:</font></div><div><font size="2"> </font></div><div><font size="2">** Bad machine code: Using an undefined physical register ***</font></div><div><font size="2">- function:    lfixedconv8</font></div><div><font size="2">- basic block:  0x91a1940 (BB#0)</font></div><div><font size="2">- instruction: %a2l<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>, %a2_32<imp-use></font></div><div><font size="2">- operand 6:   %a2_32<imp-use></font></div><div><font size="2"> </font></div><div><font size="2"> </font></div><div><font size="2">I cannot quite figure what's wrong here - the a2_32<imp-use> operand was added by the VirtualRegRewriter, because the partial def was not marked undef. The reason for this was that the LiveIntervalsAnalysis pass cleaned up after REG_SEQUENCE lowering by making the first occurence - when the interval for the reg was empty and thus created - an <def,undef>, but then it does not do the same for the other subreg, as at that time the interval for the reg is not empty.</font></div><div><font size="2"> </font></div><div><font size="2">Can anyone say what went wrong?</font></div></font></div></span></blockquote><div><br></div><div>The COPY with additional <imp-def> operands shouldn't have been deleted. It should have been turned into a KILL pseudo-instruction instead, preserving the operands and the liveness of the super-register.</div><div><br></div><div>This bug was fixed by deleting VirtRegRewriter ;-)</div><div><br></div><div>/jakob</div><div><br></div></div></body></html>