From c80476994516f9df0063bd787a5cfc8aed686c3c Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 29 Apr 2015 08:15:52 +0000 Subject: [PATCH] tree-vect-data-refs.c (vect_analyze_group_access): Properly compute GROUP_SIZE for basic-block SLP. 2015-04-29 Richard Biener * tree-vect-data-refs.c (vect_analyze_group_access): Properly compute GROUP_SIZE for basic-block SLP. * tree-vect-slp.c (vect_get_place_in_interleaving_chain): Properly take into account gaps. (vect_get_mask_element): Properly reject references to previous vectors. (vect_transform_slp_perm_load): Likewise. From-SVN: r222560 --- gcc/ChangeLog | 10 ++++++++++ gcc/tree-vect-data-refs.c | 2 +- gcc/tree-vect-slp.c | 18 ++++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9a58cbe9b26..49e6d805650 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-04-29 Richard Biener + + * tree-vect-data-refs.c (vect_analyze_group_access): Properly + compute GROUP_SIZE for basic-block SLP. + * tree-vect-slp.c (vect_get_place_in_interleaving_chain): Properly + take into account gaps. + (vect_get_mask_element): Properly reject references to previous + vectors. + (vect_transform_slp_perm_load): Likewise. + 2015-04-29 Christian Bruel PR target/64835 diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 3913862eb6c..96afc7ab68d 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2245,7 +2245,7 @@ vect_analyze_group_access (struct data_reference *dr) } if (groupsize == 0) - groupsize = count; + groupsize = count + gaps; GROUP_SIZE (vinfo_for_stmt (stmt)) = groupsize; if (dump_enabled_p ()) diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index b066763bec7..60f257b4da9 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -223,8 +223,9 @@ vect_get_place_in_interleaving_chain (gimple stmt, gimple first_stmt) { if (next_stmt == stmt) return result; - result++; next_stmt = GROUP_NEXT_ELEMENT (vinfo_for_stmt (next_stmt)); + if (next_stmt) + result += GROUP_GAP (vinfo_for_stmt (next_stmt)); } while (next_stmt); @@ -3008,6 +3009,18 @@ vect_get_mask_element (gimple stmt, int first_mask_element, int m, /* Adjust the value in case it's a mask for second and third vectors. */ *current_mask_element -= mask_nunits * (*number_of_mask_fixes - 1); + if (*current_mask_element < 0) + { + if (dump_enabled_p ()) + { + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "permutation requires past vector "); + dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0); + dump_printf (MSG_MISSED_OPTIMIZATION, "\n"); + } + return false; + } + if (*current_mask_element < mask_nunits) *needs_first_vector = true; @@ -3178,7 +3191,8 @@ vect_transform_slp_perm_load (slp_tree node, vec dr_chain, &number_of_mask_fixes, &mask_fixed, &needs_first_vector)) return false; - gcc_assert (current_mask_element < 2 * nunits); + gcc_assert (current_mask_element >= 0 + && current_mask_element < 2 * nunits); mask[index++] = current_mask_element; if (index == nunits) -- 2.30.2