On Fri, 22 Nov 2024, Alexandre Oliva wrote:

> 
> When everything else fails, if enabled by the target or by a
> parameter, and when other requirements are satisfied, ifcombine
> generates an AND of both conditions.
> 
> That may be good for contiguous conditions, but it's unlikely to be an
> optimization when the blocks are separate.
> 
> Add contiguity to the set of requirements for this fallback
> transformation.
> 
> Regstrapped on x86_64-linux-gnu.  Ok to install?

OK.

Thanks,
Richard.

> 
> for  gcc/ChangeLog
> 
>       * tree-ssa-ifcombine.cc (ifcombine_ifandif): Avoid fallback
>       conjunction of noncontiguous conditions.
> ---
>  gcc/tree-ssa-ifcombine.cc |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/gcc/tree-ssa-ifcombine.cc b/gcc/tree-ssa-ifcombine.cc
> index 9b9dc10cd2202..51f37f15a9efc 100644
> --- a/gcc/tree-ssa-ifcombine.cc
> +++ b/gcc/tree-ssa-ifcombine.cc
> @@ -974,6 +974,10 @@ ifcombine_ifandif (basic_block inner_cond_bb, bool 
> inner_inv,
>                                           gimple_cond_rhs (outer_cond),
>                                           gimple_bb (outer_cond))))
>       {
> +       /* Only combine conditions in this fallback case if the blocks are
> +          neighbors.  */
> +       if (single_pred (inner_cond_bb) != outer_cond_bb)
> +         return false;
>         tree t1, t2;
>         bool logical_op_non_short_circuit = LOGICAL_OP_NON_SHORT_CIRCUIT;
>         if (param_logical_op_non_short_circuit != -1)
> 
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to