[PATCH]middle-end: remove more usages of single_exit
Richard Biener
rguenther@suse.de
Fri Jan 12 08:55:22 GMT 2024
On Fri, 12 Jan 2024, Tamar Christina wrote:
> Hi All,
>
> This replaces two more usages of single_exit that I had missed before.
> They both seem to happen when we re-use the ifcvt scalar loop for versioning.
>
> The condition in versioning is the same as the one for when we don't re-use the
> scalar loop.
>
> I hit these during an LTO enabled bootstrap now.
>
> Bootstrapped Regtested on aarch64-none-linux-gnu with lto enabled and no issues.
>
> Ok for master?
OK
> Thanks,
> Tamar
>
> gcc/ChangeLog:
>
> * tree-vect-loop-manip.cc (vect_loop_versioning): Replace single_exit.
> * tree-vect-loop.cc (vect_transform_loop): Likewise.
>
> --- inline copy of patch --
> diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
> index 0931b18404856f6c33dcae1ffa8d5a350dbd0f8f..0d8c90f69e9693d5d25095e799fbc17a9910779b 100644
> --- a/gcc/tree-vect-loop-manip.cc
> +++ b/gcc/tree-vect-loop-manip.cc
> @@ -4051,7 +4051,16 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
> basic_block preheader = loop_preheader_edge (loop_to_version)->src;
> preheader->count = preheader->count.apply_probability (prob * prob2);
> scale_loop_frequencies (loop_to_version, prob * prob2);
> - single_exit (loop_to_version)->dest->count = preheader->count;
> + /* When the loop has multiple exits then we can only version itself.
> + This is denoted by loop_to_version == loop. In this case we can
> + do the versioning by selecting the exit edge the vectorizer is
> + currently using. */
> + edge exit_edge;
> + if (loop_to_version == loop)
> + exit_edge = LOOP_VINFO_IV_EXIT (loop_vinfo);
> + else
> + exit_edge = single_exit (loop_to_version);
> + exit_edge->dest->count = preheader->count;
> LOOP_VINFO_SCALAR_LOOP_SCALING (loop_vinfo) = (prob * prob2).invert ();
>
> nloop = scalar_loop;
> diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
> index da2dfa176ecd457ebc11d1131302ca15d77d779d..eccf0953bbae2a0e95efba0966c85492e5057b14 100644
> --- a/gcc/tree-vect-loop.cc
> +++ b/gcc/tree-vect-loop.cc
> @@ -11910,8 +11910,7 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call)
> (LOOP_VINFO_SCALAR_LOOP_SCALING (loop_vinfo));
> scale_loop_frequencies (LOOP_VINFO_SCALAR_LOOP (loop_vinfo),
> LOOP_VINFO_SCALAR_LOOP_SCALING (loop_vinfo));
> - single_exit (LOOP_VINFO_SCALAR_LOOP (loop_vinfo))->dest->count
> - = preheader->count;
> + LOOP_VINFO_SCALAR_IV_EXIT (loop_vinfo)->dest->count = preheader->count;
> }
>
> if (niters_vector == NULL_TREE)
>
>
>
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)
More information about the Gcc-patches
mailing list