Tom Stellard
2012-Feb-22 20:01 UTC
[LLVMdev] Eliminating copies between overlapping register classes
Hi, I have two register classes A and B, where A contains a subset of the registers in B: A = [R0, R1, R2, ... R128] B = [RO, R1, R2, ... R128, T0, T1, T2, ... T128] I am using the Greedy Register Allocator, and I would expect the register allocator to eliminate this copy: %vreg0<def> = COPY %vreg1; B:%vreg0 A:%vreg1 but instead I end up with %R0<def> = COPY %R1 Is there any way I can get the register allocator to eliminate these kinds of copies? Thanks, Tom
Jakob Stoklund Olesen
2012-Feb-23 03:00 UTC
[LLVMdev] Eliminating copies between overlapping register classes
On Feb 22, 2012, at 12:01 PM, Tom Stellard wrote:> Hi, > > I have two register classes A and B, where A contains a subset of the > registers in B: > > A = [R0, R1, R2, ... R128] > > B = [RO, R1, R2, ... R128, > T0, T1, T2, ... T128] > > I am using the Greedy Register Allocator, and I would expect the register > allocator to eliminate this copy: > > %vreg0<def> = COPY %vreg1; B:%vreg0 A:%vreg1 > > but instead I end up with > > %R0<def> = COPY %R1 > > Is there any way I can get the register allocator to eliminate these > kinds of copies?Such copies should be eliminated as aggressively as normal copies. Perhaps the debug output from RegisterCoalescer can tell you why they aren't. /jakob
Tom Stellard
2012-Feb-23 17:50 UTC
[LLVMdev] Eliminating copies between overlapping register classes
On Wed, Feb 22, 2012 at 07:00:55PM -0800, Jakob Stoklund Olesen wrote:> > On Feb 22, 2012, at 12:01 PM, Tom Stellard wrote: > > > Hi, > > > > I have two register classes A and B, where A contains a subset of the > > registers in B: > > > > A = [R0, R1, R2, ... R128] > > > > B = [RO, R1, R2, ... R128, > > T0, T1, T2, ... T128] > > > > I am using the Greedy Register Allocator, and I would expect the register > > allocator to eliminate this copy: > > > > %vreg0<def> = COPY %vreg1; B:%vreg0 A:%vreg1 > > > > but instead I end up with > > > > %R0<def> = COPY %R1 > > > > Is there any way I can get the register allocator to eliminate these > > kinds of copies? > > Such copies should be eliminated as aggressively as normal copies. Perhaps the debug output from RegisterCoalescer can tell you why they aren't. > > /jakobThanks for the debugging type, I caught my mistake. Class A wasn't actually a subset of B. The definitions were actually like this: A = [R0, R1, R2, ... R128, CC] B = [RO, R1, R2, ... R128, T0, T1, T2, ... T128 Thanks, Tom
Maybe Matching Threads
- [LLVMdev] Eliminating copies between overlapping register classes
- [LLVMdev] Eliminating copies between overlapping register classes
- [LLVMdev] RegisterCoalescing Pass seems to ignore part of CFG.
- [LLVMdev] Missing optimization - constant parameter
- [LLVMdev] Missing optimization - constant parameter