extend fwprop optimization

Steven Bosscher stevenb.gcc@gmail.com
Tue Feb 26 00:08:00 GMT 2013

On Tue, Feb 26, 2013 at 12:32 AM, Wei Mi wrote:
> We also take insn splitting and peephole into consideration,
> .i.e, the cost of the change is the cost after insn splitting and
> peephole which may be applied to the insn changed. This is useful for
> the motivational case,

It also goes against everything ever done before in RTL land.

If you need early splitting like this, then these insns should
probably be splitted earlier. And trying to apply peephole2's at this
stage is, ehm, very creative... I'm surprised it works at all,
peephole2 is supposed to work on strict RTL (i.e. post-reload, all
constraints matched, hard regiters only, etc.). NB, you can't use
peephole2 unconditionally, not all targets have them. See

Can you explain step-by-step what is going on, that you need this?

> -      break;
> +      /* Compare registers by number.  */
> +    case REG:
> +      return REG_P (reg) && REGNO (in) == REGNO (reg);

This will not work for hard registers.

FWIW, en passant you've made fwprop quadratic in the number of insns
in a basic block, in initialize_before_estimate_peephole potentially
calling simulate_backwards_to_point repeatedly on every insn in a
basic block.

Also: no ChangeLog, not following code style conventions, no comments,
entire blocks of recently added code disappearing (e.g. the "Do not
replace an existing REG_EQUAL note" stuff)...

Don't mean to be too harsh, but in this form I'm not going to look at it.


More information about the Gcc-patches mailing list