Hi, I'm facing a problem in my BE while trying to remove certain copies. Here is a code snippet which I would like to optimize %vreg1<def> = READF32r; vRRegs:%vreg1 %vreg2<def> = COPY %vreg1:rsub_h; iRSubRegs:%vreg2 vRRegs:%vreg1 %vreg3<def> = COPY %vreg1:rsub_l; iRSubRegs:%vreg3 vRRegs:%vreg1 This code produces subreg-to-subreg copies but I would like to have direct uses of vreg1's subregisters instead. I tried to add RAhints in order to form identity copies (vreg1 and vreg2/3 should be allocated to the same sub/super register) and let the RA removes them automatically but it didn't work on all the copies. Is there another method to get rid of these copies whenever possible ? Ivan
On Mar 28, 2012, at 7:41 AM, Ivan Llopard <ivanllopard at gmail.com> wrote:> Hi, > > I'm facing a problem in my BE while trying to remove certain copies. > Here is a code snippet which I would like to optimize > > %vreg1<def> = READF32r; vRRegs:%vreg1 > %vreg2<def> = COPY %vreg1:rsub_h; iRSubRegs:%vreg2 vRRegs:%vreg1 > %vreg3<def> = COPY %vreg1:rsub_l; iRSubRegs:%vreg3 vRRegs:%vreg1 > > This code produces subreg-to-subreg copies but I would like to have > direct uses of vreg1's subregisters instead. > I tried to add RAhints in order to form identity copies (vreg1 and > vreg2/3 should be allocated to the same sub/super register) and let the > RA removes them automatically but it didn't work on all the copies. Is > there another method to get rid of these copies whenever possible ?I assume you are using svn trunk, otherwise I recommend you upgrade. The output of -debug-only=regalloc should tell you why the register coalescer isn't eliminating the copies. /jakob
Hi Jakob, Le 28/03/2012 18:51, Jakob Stoklund Olesen a écrit :> On Mar 28, 2012, at 7:41 AM, Ivan Llopard<ivanllopard at gmail.com> wrote: > >> Hi, >> >> I'm facing a problem in my BE while trying to remove certain copies. >> Here is a code snippet which I would like to optimize >> >> %vreg1<def> = READF32r; vRRegs:%vreg1 >> %vreg2<def> = COPY %vreg1:rsub_h; iRSubRegs:%vreg2 vRRegs:%vreg1 >> %vreg3<def> = COPY %vreg1:rsub_l; iRSubRegs:%vreg3 vRRegs:%vreg1 >> >> This code produces subreg-to-subreg copies but I would like to have >> direct uses of vreg1's subregisters instead. >> I tried to add RAhints in order to form identity copies (vreg1 and >> vreg2/3 should be allocated to the same sub/super register) and let the >> RA removes them automatically but it didn't work on all the copies. Is >> there another method to get rid of these copies whenever possible ? > I assume you are using svn trunk, otherwise I recommend you upgrade. > > The output of -debug-only=regalloc should tell you why the register coalescer isn't eliminating the copies.Thanks ! Looking into the coalescer, I realized I forgot to implement the hook getMatchingSuperRegClass(). Now, it works smoothly! Regards, Ivan> > /jakob >
Apparently Analagous Threads
- [LLVMdev] Remove subreg copies
- [LLVMdev] MachineOperand: Subreg defines and the Undef flag
- [LLVMdev] MachineOperand: Subreg defines and the Undef flag
- [LLVMdev] MachineOperand: Subreg defines and the Undef flag
- [LLVMdev] MachineOperand: Subreg defines and the Undef flag