Fix PR87953

Message ID alpine.LSU.2.20.1811091328300.1827@zhemvz.fhfr.qr
State New
Headers show
Series
  • Fix PR87953
Related show

Commit Message

Richard Biener Nov. 9, 2018, 12:29 p.m.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2018-11-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/87953
	* tree-vect-loop.c (vectorizable_reduction): For analysis
	always pass ops[0] to vectorizable_condition.

Patch

diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 22bed26609b..dad6524ee2b 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -6525,9 +6525,10 @@  vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
   if (code == COND_EXPR)
     {
       /* Only call during the analysis stage, otherwise we'll lose
-	 STMT_VINFO_TYPE.  */
+	 STMT_VINFO_TYPE.  We'll pass ops[0] as reduc_op, it's only
+	 used as a flag during analysis.  */
       if (!vec_stmt && !vectorizable_condition (stmt_info, gsi, NULL,
-						ops[reduc_index], 0, NULL,
+						ops[0], 0, NULL,
 						cost_vec))
         {
           if (dump_enabled_p ())