diff mbox

Fix PR tree-optimization/51684

Message ID OF11673AE2.DA0FA9BC-ONC2257974.00324DB8-C2257974.00335DAD@il.ibm.com
State New
Headers show

Commit Message

Ira Rosen Dec. 28, 2011, 9:21 a.m. UTC
Hi,

This patch fixes an attempt to access gsi of pattern statement.

Bootstrapped and tested on ia64-unknown-linux-gnu by Uros and on
powerpc64-suse-linux by me.

Committed.

Ira

ChangeLog:

	PR tree-optimization/51684
	* tree-vect-slp.c (vect_schedule_slp_instance): Get gsi of original
	statement in case of a pattern.
	(vect_schedule_slp): Likewise.
diff mbox

Patch

Index: gcc/tree-vect-slp.c
===================================================================
--- gcc/tree-vect-slp.c (revision 182703)
+++ gcc/tree-vect-slp.c (working copy)
@@ -2885,6 +2885,8 @@  vect_schedule_slp_instance (slp_tree node, slp_ins
       && REFERENCE_CLASS_P (gimple_get_lhs (stmt)))
     {
       gimple last_store = vect_find_last_store_in_slp_instance (instance);
+      if (is_pattern_stmt_p (vinfo_for_stmt (last_store)))
+       last_store = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (last_store));
       si = gsi_for_stmt (last_store);
     }

@@ -2989,6 +2991,8 @@  vect_schedule_slp (loop_vec_info loop_vinfo, bb_ve
           if (!STMT_VINFO_DATA_REF (vinfo_for_stmt (store)))
             break;

+         if (is_pattern_stmt_p (vinfo_for_stmt (store)))
+           store = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (store));
           /* Free the attached stmt_vec_info and remove the stmt.  */
           gsi = gsi_for_stmt (store);
           gsi_remove (&gsi, true);