diff options
author | Kyrylo Tkachov <kyrylo.tkachov@arm.com> | 2018-11-19 17:58:00 +0000 |
---|---|---|
committer | Kyrylo Tkachov <ktkachov@gcc.gnu.org> | 2018-11-19 17:58:00 +0000 |
commit | 1fd319753c90f05e026e16c2c83af8f1c6687a5f (patch) | |
tree | ab4289df64afcccb0a32340e0dcde7d83a62d344 /gcc/tree-vect-loop.c | |
parent | c95c552804da90c830941111706e623106a7728a (diff) | |
download | gcc-1fd319753c90f05e026e16c2c83af8f1c6687a5f.zip gcc-1fd319753c90f05e026e16c2c83af8f1c6687a5f.tar.gz gcc-1fd319753c90f05e026e16c2c83af8f1c6687a5f.tar.bz2 |
Disable unrolling for loops vectorised with non-constant VF
This is an alternative to https://gcc.gnu.org/ml/gcc-patches/2018-11/msg00694.html
As richi suggested, this disables unrolling of loops vectorised with variable-length SVE
in the vectoriser itself through the loop->unroll member.
It took me a few tries to get it right, as it needs to be set to '1' to disable unrolling,
the rationale for that mechanism is described in the comment in cfgloop.h.
* tree-vect-loop.c (vect_transform_loop): Disable further unrolling
of the loop if vf is non-constant.
* gcc.target/aarch64/sve/unroll-1.c: New test.
From-SVN: r266281
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 81d8d46..07a22d7 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -8515,6 +8515,15 @@ vect_transform_loop (loop_vec_info loop_vinfo) } } + /* Loops vectorized with a variable factor won't benefit from + unrolling/peeling. */ + if (!vf.is_constant ()) + { + loop->unroll = 1; + if (dump_enabled_p ()) + dump_printf_loc (MSG_NOTE, vect_location, "Disabling unrolling due to" + " variable-length vectorization factor\n"); + } /* Free SLP instances here because otherwise stmt reference counting won't work. */ slp_instance instance; |