On 9/7/26 8:43 AM, [email protected] wrote:
From: Kyrylo Tkachov <[email protected]>

Every branchless noce_try_* matcher ends with the same tail: wind up the
candidate sequence with end_ifcvt_sequence, reject it when it fails to
build (and, for most, when the target deems it unprofitable), otherwise
emit it before the branch, record the transform name and return true.  This
block is copy-pasted, with small whitespace drift, in more than a dozen
matchers.

Introduce noce_commit_sequence to hold it and route the uniform matchers
through it.  A caller now ends with:

   seq = end_ifcvt_sequence (if_info);
   return noce_commit_sequence (if_info, seq, PROFITABLE, "noce_try_foo");

The PROFITABLE argument preserves each matcher exactly: the ones that never
consulted targetm.noce_conversion_profitable_p pass false.  No functional
change.

noce_try_move and noce_try_bitop emit their sequence conditionally, and
noce_try_minmax and noce_try_abs write extra if_info fields in the tail, so
those keep their own tails.

gcc/ChangeLog:

        * ifcvt.cc (noce_commit_sequence): New function.
        (noce_try_ifelse_collapse, noce_try_store_flag,
        noce_try_sign_bit_splat, noce_try_inverse_constants,
        noce_try_shifted_store_flag, noce_try_store_flag_constants,
        noce_try_store_flag_logical, noce_try_addcc,
        noce_try_store_flag_mask, noce_try_cmove, noce_try_cmove_arith,
        noce_try_cond_arith, noce_try_sign_mask): Use it.

Signed-off-by: Kyrylo Tkachov <[email protected]>
So this is a prereq (IMHO) for the work Shreya and are teeing up. One of the steps is to defer what you're calling noce_commit_sequence until after we've tried all the ifcvt methods, selecting the least costly method.

OK
jeff

Reply via email to