https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118361

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note for AVR there's also the peculiarity that wide operations have an optab
and are even initially expanded to wide operation:

(insn 10 9 11 2 (set (reg:SI 54 [ _8 ])
        (ashift:SI (reg:SI 53)
            (const_int 3 [0x3]))) "t.c":3:8 -1
     (nil))

And IIRC some become a libcall only at assembly emission time, never exposed
to GCC directly.

The historical cost "knob" for if-conversion is rtx_cost vs. BRANCH_COST.
On GIMPLE there's neither though we use BRANCH_COST there to some extent.

if-conversion on GIMPLE is mostly an enabler for more GIMPLE optimization
and isn't generally viewed as direct code generation selection but it starts
to show that this is problematic.

In tree-ssa-phiopt.cc we do in two places:

      bool allowed = !early_p || phiopt_early_allow (seq1, op);

where I think the early_p case is less problematic even for AVR but as
you can see we allow all replacements (all match.pd patterns) for the
late invocations.

I would suggest to try sth like

   bool allowed = (!early_p && targetm.allow_ifconv (TYPE_MODE (type)))
                  || phiopt_early_allow (seq1, op);

alternatively of course the full replacement GIMPLE sequence could be
fed to the hook (note the sequence is not cleaned of eventually unused
temporary simplifications).

Reply via email to