re PR tree-optimization/77848 (Gimple if-conversion results in redundant comparisons)
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Thu, 17 Nov 2016 14:22:17 +0000 (14:22 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Thu, 17 Nov 2016 14:22:17 +0000 (14:22 +0000)
[gcc]

2016-11-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
            Richard Biener  <rguenther@suse.de>

PR tree-optimization/77848
* tree-if-conv.c (tree_if_conversion): Always version loops unless
the user specified -ftree-loop-if-convert.

[gcc/testsuite]

2016-11-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
            Richard Biener  <rguenther@suse.de>

PR tree-optimization/77848
* gfortran.dg/vect/pr77848.f: New test.

Co-Authored-By: Richard Biener <rguenther@suse.de>
From-SVN: r242550

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/vect/pr77848.f [new file with mode: 0644]
gcc/tree-if-conv.c

index 8797a21..b9b3b8a 100644 (file)
@@ -1,3 +1,10 @@
+2016-11-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+            Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/77848
+       * tree-if-conv.c (tree_if_conversion): Always version loops unless
+       the user specified -ftree-loop-if-convert.
+
 2016-11-17  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR target/77308
        * rtl.h: Declare gt_ggc_mx and gt_pch_nx.
 
 2016-11-16  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+           Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/77848
        * tree-if-conv.c (version_loop_for_if_conversion): When versioning
index e16f2d0..bd76620 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-17  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
+            Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/77848
+       * gfortran.dg/vect/pr77848.f: New test.
+
 2016-11-17  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR target/77308
diff --git a/gcc/testsuite/gfortran.dg/vect/pr77848.f b/gcc/testsuite/gfortran.dg/vect/pr77848.f
new file mode 100644 (file)
index 0000000..d54676e
--- /dev/null
@@ -0,0 +1,24 @@
+! PR 77848: Verify versioning is on when vectorization fails
+! { dg-do compile }
+! { dg-options "-O3 -ffast-math -fdump-tree-ifcvt -fdump-tree-vect-details" }
+
+      subroutine sub(x,a,n,m)
+      implicit none
+      real*8 x(*),a(*),atemp
+      integer i,j,k,m,n
+      real*8 s,t,u,v
+      do j=1,m
+         atemp=0.d0
+         do i=1,n
+            if (abs(a(i)).gt.atemp) then
+               atemp=a(i)
+               k = i
+            end if
+         enddo
+         call dummy(atemp,k)
+      enddo
+      return
+      end
+
+! { dg-final { scan-tree-dump "LOOP_VECTORIZED" "ifcvt" } }
+! { dg-final { scan-tree-dump "vectorized 0 loops in function" "vect" } }
index dc97fc4..1235faf 100644 (file)
@@ -2803,10 +2803,12 @@ tree_if_conversion (struct loop *loop)
          || loop->dont_vectorize))
     goto cleanup;
 
-  /* Either version this loop, or if the pattern is right for outer-loop
-     vectorization, version the outer loop.  In the latter case we will
-     still if-convert the original inner loop.  */
-  if ((any_pred_load_store || any_complicated_phi)
+  /* Since we have no cost model, always version loops unless the user
+     specified -ftree-loop-if-convert.  Either version this loop, or if
+     the pattern is right for outer-loop vectorization, version the
+     outer loop.  In the latter case we will still if-convert the
+     original inner loop.  */
+  if (flag_tree_loop_if_convert != 1
       && !version_loop_for_if_conversion
       (versionable_outer_loop_p (loop_outer (loop))
        ? loop_outer (loop) : loop))