This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 3/4] Add a pass_copy_prop following pass_ch_vect
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Alan Lawrence <alan dot lawrence at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 26 Dec 2015 18:58:01 +0100
- Subject: Re: [PATCH 3/4] Add a pass_copy_prop following pass_ch_vect
- Authentication-results: sourceware.org; auth=none
- References: <1450703608-8617-1-git-send-email-alan dot lawrence at arm dot com> <1450703608-8617-4-git-send-email-alan dot lawrence at arm dot com>
On Mon, Dec 21, 2015 at 2:13 PM, Alan Lawrence <alan.lawrence@arm.com> wrote:
> This fixes the missed vectorization of gcc.dg/vect/pr65947-2.c following the
> previous patch, by cleaning up:
>
> i_49 = 1;
> ...
> goto <bb 3>;
>
> <bb 3>:
>
> <bb 4>: <--- LOOP HEADER
> # i_53 = PHI <i_42(7), i_49(3)>
>
> into:
>
> <bb 3>:
> # i_53 = PHI <i_42(4), 1(2)>
>
> Allowing scalar evolution and vectorization to proceed.
>
> A similar sequence of partial peeling, header-copying, and constant propagation
> also leads to pr65947-9.c successfully vectorizing (it previously didn't as
> the iteration count was too high) when inlined and so using known data.
>
> I'm not sure whether adding a pass_copy_prop is the right thing here, but since
> loop-header-copying can create such opportunities, it seems good to take them!
Aww. I'd rather have general infrastructure (like SCEV) deal with
those non-propagated
copies.
There are likely other missed propagation / folding opportunities
caused from partial peeling.
Richard.
> gcc/ChangeLog:
>
> * passes.def: Add a pass_copy_prop following pass_ch_vect.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/vect/pr65947-9.c: Add __attribute__ ((noinline)).
>
> --Alan
> ---
> gcc/passes.def | 1 +
> gcc/testsuite/gcc.dg/vect/pr65947-9.c | 2 +-
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/passes.def b/gcc/passes.def
> index 624d121..1043548 100644
> --- a/gcc/passes.def
> +++ b/gcc/passes.def
> @@ -269,6 +269,7 @@ along with GCC; see the file COPYING3. If not see
> NEXT_PASS (pass_expand_omp_ssa);
> POP_INSERT_PASSES ()
> NEXT_PASS (pass_ch_vect);
> + NEXT_PASS (pass_copy_prop);
> NEXT_PASS (pass_if_conversion);
> /* pass_vectorize must immediately follow pass_if_conversion.
> Please do not add any other passes in between. */
> diff --git a/gcc/testsuite/gcc.dg/vect/pr65947-9.c b/gcc/testsuite/gcc.dg/vect/pr65947-9.c
> index d0da13f..c7aac8d 100644
> --- a/gcc/testsuite/gcc.dg/vect/pr65947-9.c
> +++ b/gcc/testsuite/gcc.dg/vect/pr65947-9.c
> @@ -7,7 +7,7 @@ extern void abort (void) __attribute__ ((noreturn));
> /* Condition reduction with maximum possible loop size. Will fail to
> vectorize because the vectorisation requires a slot for default values. */
>
> -char
> +__attribute__ ((noinline)) char
> condition_reduction (char *a, char min_v)
> {
> char last = -72;
> --
> 1.9.1
>