From 4e9d58d16767b1bc686f0c4b3bd2da25dc71e8f3 Mon Sep 17 00:00:00 2001 From: Andre Vieira Date: Fri, 8 Nov 2019 13:52:56 +0000 Subject: [vect] PR 92351: When peeling for alignment make alignment of epilogues unknown gcc/ChangeLog: 2019-11-08 Andre Vieira PR tree-optimization/92351 * tree-vect-data-refs.c (vect_compute_data_ref_alignment): When we are peeling the main loop for alignment, make sure to set the misalignment of the epilogue's data references to DR_MISALIGNMENT_UNKNOWN. gcc/testsuite/ChangeLog: 2019-11-08 Andre Vieira PR tree-optimization/92351 * gcc.dg/vect/vect-peel-2.c: Disable epilogue vectorization and split the source of this test to... * gcc.dg/vect/vect-peel-2-src.c: ... This. * gcc.dg/vect/vect-peel-2-epilogues.c: New test. From-SVN: r277974 --- gcc/tree-vect-data-refs.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gcc/tree-vect-data-refs.c') diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 36639b6..88f14e7 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -938,6 +938,18 @@ vect_compute_data_ref_alignment (dr_vec_info *dr_info) = exact_div (vect_calculate_target_alignment (dr_info), BITS_PER_UNIT); DR_TARGET_ALIGNMENT (dr_info) = vector_alignment; + /* If the main loop has peeled for alignment we have no way of knowing + whether the data accesses in the epilogues are aligned. We can't at + compile time answer the question whether we have entered the main loop or + not. Fixes PR 92351. */ + if (loop_vinfo) + { + loop_vec_info orig_loop_vinfo = LOOP_VINFO_ORIG_LOOP_INFO (loop_vinfo); + if (orig_loop_vinfo + && LOOP_VINFO_PEELING_FOR_ALIGNMENT (orig_loop_vinfo) != 0) + return; + } + unsigned HOST_WIDE_INT vect_align_c; if (!vector_alignment.is_constant (&vect_align_c)) return; -- cgit v1.1