From cb9ed5d79fe359fe089e43b3851a72e7e27c5316 Mon Sep 17 00:00:00 2001 From: Dorit Nuzman Date: Thu, 3 May 2007 12:54:45 +0000 Subject: re PR middle-end/31699 (-march=opteron -ftree-vectorize generates wrong code) PR tree-optimization/31699 * tree-vect-analyze.c (vect_update_misalignment_for_peel): Remove wrong code. (vect_enhance_data_refs_alignment): Compute peel amount using TYPE_VECTOR_SUBPARTS instead of vf. * tree-vect-transform.c (vect_gen_niters_for_prolog_loop): Likewise. From-SVN: r124375 --- gcc/tree-vect-analyze.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'gcc/tree-vect-analyze.c') diff --git a/gcc/tree-vect-analyze.c b/gcc/tree-vect-analyze.c index c195c7a..3a4841d 100644 --- a/gcc/tree-vect-analyze.c +++ b/gcc/tree-vect-analyze.c @@ -1258,15 +1258,6 @@ vect_update_misalignment_for_peel (struct data_reference *dr, if (DR_GROUP_FIRST_DR (peel_stmt_info)) dr_peel_size *= DR_GROUP_SIZE (peel_stmt_info); - if (known_alignment_for_access_p (dr) - && known_alignment_for_access_p (dr_peel) - && (DR_MISALIGNMENT (dr) / dr_size == - DR_MISALIGNMENT (dr_peel) / dr_peel_size)) - { - DR_MISALIGNMENT (dr) = 0; - return; - } - /* It can be assumed that the data refs with the same alignment as dr_peel are aligned in the vector loop. */ same_align_drs @@ -1507,7 +1498,8 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) the prolog loop ({VF - misalignment}), is a multiple of the number of the interleaved accesses. */ int elem_size, mis_in_elements; - int vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo); + tree vectype = STMT_VINFO_VECTYPE (stmt_info); + int nelements = TYPE_VECTOR_SUBPARTS (vectype); /* FORNOW: handle only known alignment. */ if (!known_alignment_for_access_p (dr)) @@ -1516,10 +1508,10 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) break; } - elem_size = UNITS_PER_SIMD_WORD / vf; + elem_size = UNITS_PER_SIMD_WORD / nelements; mis_in_elements = DR_MISALIGNMENT (dr) / elem_size; - if ((vf - mis_in_elements) % DR_GROUP_SIZE (stmt_info)) + if ((nelements - mis_in_elements) % DR_GROUP_SIZE (stmt_info)) { do_peeling = false; break; @@ -1541,6 +1533,10 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) { int mis; int npeel = 0; + tree stmt = DR_STMT (dr0); + stmt_vec_info stmt_info = vinfo_for_stmt (stmt); + tree vectype = STMT_VINFO_VECTYPE (stmt_info); + int nelements = TYPE_VECTOR_SUBPARTS (vectype); if (known_alignment_for_access_p (dr0)) { @@ -1550,7 +1546,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo) factor minus the misalignment as an element count. */ mis = DR_MISALIGNMENT (dr0); mis /= GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (DR_REF (dr0)))); - npeel = LOOP_VINFO_VECT_FACTOR (loop_vinfo) - mis; + npeel = nelements - mis; /* For interleaved data access every iteration accesses all the members of the group, therefore we divide the number of iterations -- cgit v1.1