diff mbox series

Fix PR92405

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

Commit Message

Richard Biener Nov. 7, 2019, 11:47 a.m. UTC
Bootstrapped & tested on x86_64-unknown-linux-gnu, applied.

Richard.

2019-11-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/92405
	* tree-vect-loop.c (vectorizable_reduction): Appropriately
	restrict lane-reducing ops to single stmt chains.
diff mbox series

Patch

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c	(revision 277907)
+++ gcc/tree-vect-loop.c	(working copy)
@@ -5865,6 +5865,18 @@  vectorizable_reduction (stmt_vec_info st
       reduc_chain_length++;
     }
 
+  /* For lane-reducing ops we're reducing the number of reduction PHIs
+     which means the only use of that may be in the lane-reducing operation.  */
+  if (lane_reduc_code_p
+      && reduc_chain_length != 1
+      && !only_slp_reduc_chain)
+    {
+      if (dump_enabled_p ())
+	dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+			 "lane-reducing reduction with extra stmts.\n");
+      return false;
+    }
+
   reduc_def = PHI_RESULT (reduc_def_phi);
   for (i = 0; i < op_type; i++)
     {