Hi,
I'm having an issue with subregisters on my target.
With a pseudo that writes to a 32 bit reg:
%vreg20<def> = toHi16_low0_pseudo %vreg2; reg32:%vreg20
hi16:%vreg2
expands to
%vreg2<def> = COPY %a2h; hi16:%vreg2
%vreg43<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>,
%ac1<imp-use>; lo16:%vreg43
%vreg20<def> = REG_SEQUENCE %vreg2, hi16, %vreg43, lo16;
reg32:%vreg20 hi16:%vreg2 lo16:%vreg43
Becomes
16L %vreg20:hi16<def,undef> = COPY %a2h<kill>,
%vreg20<imp-def>; reg32:%vreg20
368L %vreg20:lo16<def> = mov 0, pred:0, pred:%noreg,
%ac0<imp-use>, %ac1<imp-use>; reg32:%vreg20
Becomes
Live Ins: %a0h %a1_32 %a2h %a3_32
... (COPY coalesced as a2h is live in)
%a2l<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>,
%ac1<imp-use>, %a2_32<imp-use>
results in:
** Bad machine code: Using an undefined physical register ***
- function: lfixedconv8
- basic block: 0x91a1940 (BB#0)
- instruction: %a2l<def> = mov 0, pred:0, pred:%noreg,
%ac0<imp-use>, %ac1<imp-use>, %a2_32<imp-use>
- operand 6: %a2_32<imp-use>
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.
Can anyone say what went wrong?
Thanks,
Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120124/31044d1b/attachment.html>
On Jan 24, 2012, at 7:44 AM, Jonas Paulsson wrote:> > Hi, > > I'm having an issue with subregisters on my target. > > With a pseudo that writes to a 32 bit reg: > > %vreg20<def> = toHi16_low0_pseudo %vreg2; reg32:%vreg20 hi16:%vreg2 > > expands to > > %vreg2<def> = COPY %a2h; hi16:%vreg2 > %vreg43<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>; lo16:%vreg43 > %vreg20<def> = REG_SEQUENCE %vreg2, hi16, %vreg43, lo16; reg32:%vreg20 hi16:%vreg2 lo16:%vreg43 > > Becomes > > 16L %vreg20:hi16<def,undef> = COPY %a2h<kill>, %vreg20<imp-def>; reg32:%vreg20 > 368L %vreg20:lo16<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>; reg32:%vreg20 > > Becomes > > Live Ins: %a0h %a1_32 %a2h %a3_32 > ... (COPY coalesced as a2h is live in) > %a2l<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>, %a2_32<imp-use> > > results in: > > ** Bad machine code: Using an undefined physical register *** > - function: lfixedconv8 > - basic block: 0x91a1940 (BB#0) > - instruction: %a2l<def> = mov 0, pred:0, pred:%noreg, %ac0<imp-use>, %ac1<imp-use>, %a2_32<imp-use> > - operand 6: %a2_32<imp-use> > > > 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. > > Can anyone say what went wrong?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. This bug was fixed by deleting VirtRegRewriter ;-) /jakob -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120124/08c6f696/attachment.html>
Seemingly Similar Threads
- [LLVMdev] RegisterCoalescing Pass seems to ignore part of CFG.
- [LLVMdev] RegisterCoalescing Pass seems to ignore part of CFG.
- [LLVMdev] RegisterCoalescing Pass seems to ignore part of CFG.
- [LLVMdev] RegisterCoalescing Pass seems to ignore part of CFG.
- Machine Scheduler on Power PC: Latency Limit and Register Pressure