gcc/fix-when-peeling-for-alignment.patch

24 lines
960 B
Diff
Raw Normal View History

2020-09-22 23:16:39 +08:00
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 36639b697f1..88f14e73d65 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)
2020-09-22 23:19:51 +08:00
= exact_div (vect_calculate_target_alignment (dr_info), BITS_PER_UNIT);
2020-09-22 23:16:39 +08:00
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;