This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: extend fwprop optimization
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: Wei Mi <wmi at google dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, David Li <davidxl at google dot com>
- Date: Tue, 26 Feb 2013 01:08:10 +0100
- Subject: Re: extend fwprop optimization
- References: <CA+4CFy4N5+g0XVJ4vDtGyqHOgj15t3vDiiF0A8_1H9hKNZ+LuQ@mail.gmail.com>
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
HAVE_peephole2.
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.
Ciao!
Steven