aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop-manip.cc
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2024-01-09 11:16:16 +0000
committerTamar Christina <tamar.christina@arm.com>2024-01-09 11:16:16 +0000
commitcbf569486b2decbde0308f9f4d0f0837e4cfefd9 (patch)
tree5839d555eb053f0538adcb626c66a73f8ba358db /gcc/tree-vect-loop-manip.cc
parent468cec536322f98f2d473adbd6a8e88c625cfcdb (diff)
downloadgcc-cbf569486b2decbde0308f9f4d0f0837e4cfefd9.zip
gcc-cbf569486b2decbde0308f9f4d0f0837e4cfefd9.tar.gz
gcc-cbf569486b2decbde0308f9f4d0f0837e4cfefd9.tar.bz2
middle-end: rejects loops with nonlinear inductions and early breaks [PR113163]
We can't support nonlinear inductions other than neg when vectorizing early breaks and iteration count is known. For early break we currently require a peeled epilog but in these cases we can't compute the remaining values. gcc/ChangeLog: PR middle-end/113163 * tree-vect-loop-manip.cc (vect_can_peel_nonlinear_iv_p): Reject non-linear inductions that aren't supported. gcc/testsuite/ChangeLog: PR middle-end/113163 * gcc.target/gcn/pr113163.c: New test.
Diffstat (limited to 'gcc/tree-vect-loop-manip.cc')
-rw-r--r--gcc/tree-vect-loop-manip.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index 927f76a..2313d26 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -2063,6 +2063,25 @@ vect_can_peel_nonlinear_iv_p (loop_vec_info loop_vinfo,
return false;
}
+ /* We can't support partial vectors and early breaks with an induction
+ type other than add or neg since we require the epilog and can't
+ perform the peeling. The below condition mirrors that of
+ vect_gen_vector_loop_niters where niters_vector_mult_vf_var then sets
+ step_vector to VF rather than 1. This is what creates the nonlinear
+ IV. PR113163. */
+ if (LOOP_VINFO_EARLY_BREAKS (loop_vinfo)
+ && LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant ()
+ && LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)
+ && induction_type != vect_step_op_neg)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Peeling for epilogue is not supported"
+ " for nonlinear induction except neg"
+ " when VF is known and early breaks.\n");
+ return false;
+ }
+
return true;
}