diff mbox series

Fix PR92069

Message ID nycvar.YFH.7.76.1910141345360.5566@zhemvz.fhfr.qr
State New
Headers show
Series Fix PR92069 | expand

Commit Message

Richard Biener Oct. 14, 2019, 11:46 a.m. UTC
This fixes the PR by not setting vect_nested_cycle on the latch def
for nested cycles.

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

Richard.

2019-10-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/92069
	* tree-vect-loop.c (vect_analyze_scalar_cycles_1): For nested
	cycles do not set vect_nested_cycle on the latch definition.

	* gcc.dg/torture/pr92069.c: New testcase.
diff mbox series

Patch

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c	(revision 276950)
+++ gcc/tree-vect-loop.c	(working copy)
@@ -584,7 +584,6 @@  vect_analyze_scalar_cycles_1 (loop_vec_i
 				     "Detected vectorizable nested cycle.\n");
 
                   STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_nested_cycle;
-		  STMT_VINFO_DEF_TYPE (reduc_stmt_info) = vect_nested_cycle;
                 }
               else
                 {
Index: gcc/testsuite/gcc.dg/torture/pr92069.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr92069.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/torture/pr92069.c	(working copy)
@@ -0,0 +1,19 @@ 
+/* { dg-do compile } */
+/* { dg-additional-options "-ftree-vectorize" } */
+
+unsigned int a, c, d;
+double b;
+void e()
+{
+  for (; d; d++)
+    {
+      double f;
+      a = 2;
+      for (; a; a++)
+	{
+	  c = b;
+	  b = f;
+	  f = c;
+	}
+    }
+}