[PATCH] Fix PR87953

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Fix PR87953

Richard Biener

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

Richard.

2018-11-09  Richard Biener  <[hidden email]>

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

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 ())