Skip properly debug stmt in optimize_mask_stores (PR
authorMartin Liska <marxin@gcc.gnu.org>
Thu, 3 Mar 2016 10:08:09 +0000 (10:08 +0000)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 3 Mar 2016 10:08:09 +0000 (10:08 +0000)
PR tree-optimization/70043
* tree-vect-loop.c (optimize_mask_stores): Move iterator to
previous statement if we see a debug statement.
* gfortran.dg/vect/pr70043.f90: New test.

From-SVN: r233934

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

index 97d3bb6144e8cfd89c72a7e72d649095d7e6e0f7..e232f529426174451655d34a01ed18e5f2fc28b5 100644 (file)
@@ -1,3 +1,9 @@
+2016-03-03  Martin Liska  <mliska@suse.cz>
+
+       PR tree-optimization/70043
+       * tree-vect-loop.c (optimize_mask_stores): Move iterator to
+       previous statement if we see a debug statement.
+
 2016-03-03  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/55936
index 93919a086813bccc87f3250ce1e59d130a87e3c1..da7307ad2cfadc29d6998e12965a922dc6788cce 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-03  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR tree-optimization/70043
+       * gfortran.dg/vect/pr70043.f90: New test.
+
 2016-03-03  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/specs/task1.ads: New test.
diff --git a/gcc/testsuite/gfortran.dg/vect/pr70043.f90 b/gcc/testsuite/gfortran.dg/vect/pr70043.f90
new file mode 100644 (file)
index 0000000..36d6a0b
--- /dev/null
@@ -0,0 +1,15 @@
+! { dg-do compile  }
+! { dg-additional-options "-Ofast -g" }
+! { dg-additional-options "-march=haswell" { target i?86-*-* x86_64-*-* } }
+
+subroutine fn1(a, b)
+  real(8), intent(in) ::  b(100)
+  real(8), intent(inout) :: a(100)
+  real(8) c
+  do i=0,100
+     if( a(i) < 0.0 ) then
+        c =  a(i) * b(i)
+        a(i) = a(i) - c / b(i)
+     endif
+  enddo
+end subroutine fn1
index 627ff1c5cf38fce4c285ee0c49a842fe0c8339ba..0cd8f750dbc6041825051fa7bfa0b28ef79ad2c1 100644 (file)
@@ -7090,7 +7090,10 @@ optimize_mask_stores (struct loop *loop)
 
              /* Skip debug statements.  */
              if (is_gimple_debug (gsi_stmt (gsi)))
-               continue;
+               {
+                 gsi_prev (&gsi);
+                 continue;
+               }
              stmt1 = gsi_stmt (gsi);
              /* Do not consider statements writing to memory or having
                 volatile operand.  */