re PR tree-optimization/69980 (Supposedly wrong SLP code emitted)
authorRichard Biener <rguenther@suse.de>
Mon, 29 Feb 2016 13:24:24 +0000 (13:24 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 29 Feb 2016 13:24:24 +0000 (13:24 +0000)
2016-02-19  Richard Biener  <rguenther@suse.de>

PR tree-optimization/69980
* tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Update
permutation of those we need to keep.

* gfortran.dg/vect/pr69980.f90: New testcase.

From-SVN: r233809

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

index 3edc42e47fffcc04f8ce3d4e57d3682c74a1c2dd..b9bde65b6a2320b13dbde7152b6ee89d7ef19aef 100644 (file)
@@ -1,3 +1,9 @@
+2016-02-19  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69980
+       * tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Update
+       permutation of those we need to keep.
+
 2016-02-29  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR target/69706
index e5ec39c67f7b9d56c8c9c162d62f834062e263f3..654ba38c714c63135db0fad223b3ef054ac9a80f 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-19  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/69980
+       * gfortran.dg/vect/pr69980.f90: New testcase.
+
 2016-02-29  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc.target/sparc/20160229-1.c: New test.
diff --git a/gcc/testsuite/gfortran.dg/vect/pr69980.f90 b/gcc/testsuite/gfortran.dg/vect/pr69980.f90
new file mode 100644 (file)
index 0000000..8a20b98
--- /dev/null
@@ -0,0 +1,40 @@
+! { dg-do run }
+! { dg-additional-options "-Ofast -fno-inline" }
+
+subroutine check (a, b)
+   real *8, intent(in) :: a(4), b(4)
+
+   IF (abs(a(1)-b(1)) > 1) THEN
+      CALL ABORT
+   END IF
+end subroutine check
+
+program main
+  real *8 :: mu(4,26), mumax(4), mumax2(4)
+
+  integer :: i, k
+
+  do k=1,26
+     do i=1,4
+        mu(i, k) = 4*(i-1) + k
+     end do
+  end do
+
+  mumax = 0; 
+  do k=1,26
+     do i=1,3
+        mumax(i) = max(mumax(i), mu(i,k)+mu(i,k))
+     end do
+  end do
+
+  mumax2 = 0;
+  do i=1,3
+     do k=1,26
+        mumax2(i) = max(mumax2(i), mu(i,k)+mu(i,k))
+     end do
+  end do
+
+  CALL check (mumax, mumax2)
+
+  return
+end program
index 988ec10e1da4d9cbcf89dabcae65291f4579ad47..d71384881b72a272ba510dd4237362e3e5c552b5 100644 (file)
@@ -1343,6 +1343,9 @@ vect_attempt_slp_rearrange_stmts (slp_instance slp_instn)
          || (group_size == GROUP_SIZE (vinfo_for_stmt (first_stmt))
              && GROUP_GAP (vinfo_for_stmt (first_stmt)) == 0))
        SLP_TREE_LOAD_PERMUTATION (node).release ();
+      else
+       for (j = 0; j < SLP_TREE_LOAD_PERMUTATION (node).length (); ++j)
+         SLP_TREE_LOAD_PERMUTATION (node)[j] = j;
     }
 
   return true;