[LLVMdev] Remove subreg copies

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Mar 28 09:51:34 PDT 2012


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




More information about the llvm-dev mailing list