tree-vect-data-refs.c (vect_analyze_group_access): Properly compute GROUP_SIZE for...
authorRichard Biener <rguenther@suse.de>
Wed, 29 Apr 2015 08:15:52 +0000 (08:15 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 29 Apr 2015 08:15:52 +0000 (08:15 +0000)
2015-04-29  Richard Biener  <rguenther@suse.de>

* 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
gcc/tree-vect-data-refs.c
gcc/tree-vect-slp.c

index 9a58cbe9b26ec7207a28a9153f0d5d8fc6c084e4..49e6d805650ab8bbf79ad3e9e42752d4c4e8555d 100644 (file)
@@ -1,3 +1,13 @@
+2015-04-29  Richard Biener  <rguenther@suse.de>
+
+       * 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  <christian.bruel@st.com>
 
        PR target/64835
index 3913862eb6c946139d9cae9e61939de8ee76d716..96afc7ab68d40c3d3eb815dad84c6421229a9914 100644 (file)
@@ -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 ())
index b066763bec78780a4169b8ca70618a3823a9ac4b..60f257b4da98a403b083e3670a4a9c9e1526da12 100644 (file)
@@ -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<tree> 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)