From: Richard Biener Date: Tue, 29 May 2018 14:35:28 +0000 (+0000) Subject: tree-vect-data-refs.c (vect_preserves_scalar_order_p): Make sure to use non-pattern... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fec0bf3084f5d5531fcdc81e13b4813db31a1750;p=gcc.git tree-vect-data-refs.c (vect_preserves_scalar_order_p): Make sure to use non-pattern stmts for get_earlier_stmt arguments. 2018-05-29 Richard Biener * tree-vect-data-refs.c (vect_preserves_scalar_order_p): Make sure to use non-pattern stmts for get_earlier_stmt arguments. * tree-vectorizer.h (get_earlier_stmt): Assert we do not get called on pattern stmts. (get_later_stmt): Likewise. From-SVN: r260896 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b70c0372731..ccf3b28d275 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-05-29 Richard Biener + + * tree-vect-data-refs.c (vect_preserves_scalar_order_p): Make + sure to use non-pattern stmts for get_earlier_stmt arguments. + * tree-vectorizer.h (get_earlier_stmt): Assert we do not get + called on pattern stmts. + (get_later_stmt): Likewise. + 2018-05-29 Martin Liska PR gcov-profile/85759 diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index f46eb467da6..9255c53189d 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -212,6 +212,10 @@ vect_preserves_scalar_order_p (gimple *stmt_a, gimple *stmt_b) (but could happen later) while reads will happen no later than their current position (but could happen earlier). Reordering is therefore only possible if the first access is a write. */ + if (is_pattern_stmt_p (stmtinfo_a)) + stmt_a = STMT_VINFO_RELATED_STMT (stmtinfo_a); + if (is_pattern_stmt_p (stmtinfo_b)) + stmt_b = STMT_VINFO_RELATED_STMT (stmtinfo_b); gimple *earlier_stmt = get_earlier_stmt (stmt_a, stmt_b); return !DR_IS_WRITE (STMT_VINFO_DATA_REF (vinfo_for_stmt (earlier_stmt))); } diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index f7646349b65..25d0aae8eaa 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -1068,8 +1068,12 @@ get_earlier_stmt (gimple *stmt1, gimple *stmt2) if (uid1 == 0 || uid2 == 0) return NULL; - gcc_checking_assert (uid1 <= stmt_vec_info_vec->length () - && uid2 <= stmt_vec_info_vec->length ()); + gcc_assert (uid1 <= stmt_vec_info_vec->length () + && uid2 <= stmt_vec_info_vec->length ()); + gcc_checking_assert ((STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (stmt1)) + || !STMT_VINFO_RELATED_STMT (vinfo_for_stmt (stmt1))) + && (STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (stmt2)) + || !STMT_VINFO_RELATED_STMT (vinfo_for_stmt (stmt2)))); if (uid1 < uid2) return stmt1; @@ -1096,8 +1100,12 @@ get_later_stmt (gimple *stmt1, gimple *stmt2) if (uid1 == 0 || uid2 == 0) return NULL; - gcc_assert (uid1 <= stmt_vec_info_vec->length ()); - gcc_assert (uid2 <= stmt_vec_info_vec->length ()); + gcc_assert (uid1 <= stmt_vec_info_vec->length () + && uid2 <= stmt_vec_info_vec->length ()); + gcc_checking_assert ((STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (stmt1)) + || !STMT_VINFO_RELATED_STMT (vinfo_for_stmt (stmt1))) + && (STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (stmt2)) + || !STMT_VINFO_RELATED_STMT (vinfo_for_stmt (stmt2)))); if (uid1 > uid2) return stmt1;