fix vectorizable_condition ICE with EXTRACT_LAST_REDUCTION
authorRichard Biener <rguenther@suse.de>
Fri, 12 Jun 2020 10:06:53 +0000 (12:06 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 12 Jun 2020 10:09:01 +0000 (12:09 +0200)
The previous reorg missed a guard around the else clause access.

2020-06-12  Richard Biener  <rguenther@suse.de>

PR tree-optimization/95633
* tree-vect-stmts.c (vectorizable_condition): Properly
guard the vec_else_clause access with EXTRACT_LAST_REDUCTION.

gcc/tree-vect-stmts.c

index cdd6f6c5e5d08e9b2e1584daefd56bac3b02673f..cf2d979fea11e1a4cb47f31e5b591a5f0a91a852 100644 (file)
@@ -9925,7 +9925,8 @@ vectorizable_condition (vec_info *vinfo,
   FOR_EACH_VEC_ELT (vec_oprnds0, i, vec_cond_lhs)
     {
       vec_then_clause = vec_oprnds2[i];
-      vec_else_clause = vec_oprnds3[i];
+      if (reduction_type != EXTRACT_LAST_REDUCTION)
+       vec_else_clause = vec_oprnds3[i];
 
       if (swap_cond_operands)
        std::swap (vec_then_clause, vec_else_clause);