This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR35171, ICE with -O3


The dot-product pattern recognizer of the vectorizer does not deal
with getting a default definition.  Dealt with thusly.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to
mainline.

Richard.

2008-02-12  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/35171
	* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Deal with
	default defs.

	* gcc.c-torture/compile/pr35171.c: New testcase.

Index: tree-vect-patterns.c
===================================================================
*** tree-vect-patterns.c	(revision 132265)
--- tree-vect-patterns.c	(working copy)
*************** vect_recog_dot_prod_pattern (tree last_s
*** 246,260 ****
  
    prod_type = half_type;
    stmt = SSA_NAME_DEF_STMT (oprnd0);
!   gcc_assert (stmt);
    stmt_vinfo = vinfo_for_stmt (stmt);
    gcc_assert (stmt_vinfo);
    if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_loop_def)
      return NULL;
-   /* FORNOW. Can continue analyzing the def-use chain when this stmt in a phi 
-      inside the loop (in case we are analyzing an outer-loop).  */
-   if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
-     return NULL; 
    expr = GIMPLE_STMT_OPERAND (stmt, 1);
    if (TREE_CODE (expr) != MULT_EXPR)
      return NULL;
--- 246,259 ----
  
    prod_type = half_type;
    stmt = SSA_NAME_DEF_STMT (oprnd0);
!   /* FORNOW.  Can continue analyzing the def-use chain when this stmt in a phi 
!      inside the loop (in case we are analyzing an outer-loop).  */
!   if (TREE_CODE (stmt) != GIMPLE_MODIFY_STMT)
!     return NULL; 
    stmt_vinfo = vinfo_for_stmt (stmt);
    gcc_assert (stmt_vinfo);
    if (STMT_VINFO_DEF_TYPE (stmt_vinfo) != vect_loop_def)
      return NULL;
    expr = GIMPLE_STMT_OPERAND (stmt, 1);
    if (TREE_CODE (expr) != MULT_EXPR)
      return NULL;
Index: testsuite/gcc.c-torture/compile/pr35171.c
===================================================================
*** testsuite/gcc.c-torture/compile/pr35171.c	(revision 0)
--- testsuite/gcc.c-torture/compile/pr35171.c	(revision 0)
***************
*** 0 ****
--- 1,10 ----
+ int f(int a, int b, short c, int d, short e)
+ {
+   int i;
+   for (i = 1; i <= 2 ; i++) {
+     c -= 4;
+     a = c;
+     d = d + (b?b:e);
+   }
+   return a + d;
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]