This is the mail archive of the
mailing list for the GCC project.
RE: Question about "instruction merge" pass when optimizing for size
- From: Robert Suchanek <Robert dot Suchanek at imgtec dot com>
- To: Jeff Law <law at redhat dot com>, DJ Delorie <dj at redhat dot com>, "sarah at hederstierna dot com" <fredrik at hederstierna dot com>
- Cc: Matthew Fortune <Matthew dot Fortune at imgtec dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Wed, 19 Aug 2015 22:07:01 +0000
- Subject: RE: Question about "instruction merge" pass when optimizing for size
- Authentication-results: sourceware.org; auth=none
- References: <CE36BD26828FA5408B9F87E4DD2ACB0B0135774D9F16 at MBXVS01 dot HMC dot local> <4ad27b0cf3dd4b12a4a2a4530ce2f15a at DAG03 dot HMC dot local> <201508192038 dot t7JKcVV7000807 at greed dot delorie dot com>,<55D4F00A dot 2 at redhat dot com>,<B5E67142681B53468FAF6B7C31356562441B12B4 at hhmail02 dot hh dot imgtec dot org>
(It appears I accidentally dropped the mailing list)
> On 08/19/2015 02:38 PM, DJ Delorie wrote:
> > I've seen this on other targets too, sometimes so bad I write a quick
> > target-specific "stupid move optimizer" pass to clean it up.
> > A generic pass would be much harder, but very useful.
> More important is to determine *why* we're getting these patterns. In
> the IRA/LRA world, they should be a lot less common.
AFAIU LRA is less likely to remove the moves if it didn't
In one specific MIPS case for 64-bit, the moves are inserted
for the sign-extension but IRA spills some of the allocnos and
assigns different hard register for the output operand in the move
as the initial register is call clobbered and the move proves to be
difficult to remove later. I found tricky to remove the move
in the register allocator and my current approach is to exploit the regname
pass to link some of the chains and rename the input registers to
turn the move into a no-op as Matthew already mentioned.
I agree that it would be ideal to do the right thing
in IRA/LRA but the heuristic is sensitive to changes.