This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] combine: Improve change_zero_ext (fixes PR71847)
On Wed, Nov 23, 2016 at 05:53:43PM +0100, Georg-Johann Lay wrote:
> >So why does the define_insn allow it?
>
> Because the insn predicate is register_operand:HI which should be fine
> as it is non-strict RTL. Or are predicates supposed to reject such odd
> operands the backend would never generate itself?
I am not sure.
> Are you saying that register_operand:HI is not correct?
No; I think register_operand:HI should not allow odd hard registers.
> IMO, if combine is playing with hard regs, it should be conservative and
> not create new hard regs out of thin air... like
>
> * Test HARD_REGNO_MODE_OK
Yes, I'll have a patch for that in a minute. Combine is supposed to make
code better, not worse ;-)
> * Don't increase HARD_REGNO_NREGS because it's not a good idea to create
> hard regs out of thin air. On avr, for example, one should strive to
> get to smaller modes, not to blow mode sizes...
Combine tries to make fewer RTL insns (not machine insns), and then rejects
a combination if the rtx costs say it is more expensive than before. It
sounds like your costs are not tuned well enough?
Segher