re PR tree-optimization/46213 (gfortran.dg/aliasing_array_result_1.f90 ICE: in vector...
authorIra Rosen <irar@il.ibm.com>
Thu, 4 Nov 2010 11:51:09 +0000 (11:51 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Thu, 4 Nov 2010 11:51:09 +0000 (11:51 +0000)
        PR tree-optimization/46213
        * tree-vect-loop.c (vect_is_simple_reduction_1): Handle
        MINUS_EXPR only if the first operand is reduction operand.

From-SVN: r166306

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/vect/pr46213.f90 [new file with mode: 0644]
gcc/tree-vect-loop.c

index 7a3cdb0535cdc4205cc195b9ccf11d70c302ec61..2cfb60a0cf0dfd71ff9584290d41c05da351a646 100644 (file)
@@ -1,3 +1,9 @@
+2010-11-04  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/46213
+       * tree-vect-loop.c (vect_is_simple_reduction_1): Handle
+       MINUS_EXPR only if the first operand is reduction operand.
+
 2010-11-04  Richard Guenther  <rguenther@suse.de>
        Richard Henderson  <rth@redhat.com>
 
index ebbd125ecbb2731b391326bac6e3eb44c6e25a2b..66fb730c89124e43dc21a0ef3b822109af786c19 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-04  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/46213
+       * gfortran.dg/vect/pr46213.f90: New.
+
 2010-11-04  Richard Guenther  <rguenther@suse.de>
 
        PR testsuite/45702
diff --git a/gcc/testsuite/gfortran.dg/vect/pr46213.f90 b/gcc/testsuite/gfortran.dg/vect/pr46213.f90
new file mode 100644 (file)
index 0000000..504d1a3
--- /dev/null
@@ -0,0 +1,25 @@
+! { dg-do compile }
+! { dg-options "-O -fno-tree-loop-ivcanon -ftree-vectorize -fno-tree-ccp -fno-tree-ch -finline-small-functions" }
+
+module foo
+  INTEGER, PARAMETER :: ONE = 1
+end module foo
+program test
+  use foo
+  integer :: a(ONE), b(ONE), c(ONE), d(ONE)
+  interface
+    function h_ext()
+    end function h_ext
+  end interface
+  c = j()
+  if (any (c .ne. check)) call myabort (7)
+contains
+  function j()
+     integer :: j(ONE), cc(ONE)
+     j = cc - j
+  end function j
+  function get_d()
+  end function get_d
+end program test
+
+! { dg-final { cleanup-tree-dump "vect" } }
index 57ca5a8c4c46df52c77bfd446f33866aca79578a..bc87965fa91e95f28938aa58d6fe2b019a4b7387 100644 (file)
@@ -1800,7 +1800,11 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
      simply rewriting this into "res += -x[i]".  Avoid changing
      gimple instruction for the first simple tests and only do this
      if we're allowed to change code at all.  */
-  if (code == MINUS_EXPR && modify)
+  if (code == MINUS_EXPR
+      && modify
+      && (op1 = gimple_assign_rhs1 (def_stmt))
+      && TREE_CODE (op1) == SSA_NAME
+      && SSA_NAME_DEF_STMT (op1) == phi)
     code = PLUS_EXPR;
 
   if (check_reduction