re PR tree-optimization/92162 (ICE in vect_create_epilog_for_reduction, at tree-vect...
authorRichard Biener <rguenther@suse.de>
Mon, 21 Oct 2019 13:43:19 +0000 (13:43 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 21 Oct 2019 13:43:19 +0000 (13:43 +0000)
2019-10-21  Richard Biener  <rguenther@suse.de>

PR tree-optimization/92162
* tree-vect-loop.c (vect_create_epilog_for_reduction): Lookup
STMT_VINFO_REDUC_IDX in reduc_info.
* tree-vect-stmts.c (vectorizable_condition): Likewise.

* gcc.dg/pr92162.c: New testcase.

From-SVN: r277261

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr92162.c [new file with mode: 0644]
gcc/tree-vect-loop.c
gcc/tree-vect-stmts.c

index 4139f7f0d6feadaa0378c1d75beea49c4ce229aa..8c20cb8c33cf1e3ca30e2434fb8849bc0fc04fa5 100644 (file)
@@ -1,3 +1,10 @@
+2019-10-21  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/92162
+       * tree-vect-loop.c (vect_create_epilog_for_reduction): Lookup
+       STMT_VINFO_REDUC_IDX in reduc_info.
+       * tree-vect-stmts.c (vectorizable_condition): Likewise.
+
 2019-10-21  Richard Biener  <rguenther@suse.de>
 
        * tree-vectorizer.h (_slp_tree::ops): New member.
index d958e642ee08c5b2f47db5d4cd49b1ab5544b1a5..0259236e41692fd3367d0b44dc0a8ac342636a3d 100644 (file)
@@ -1,3 +1,8 @@
+2019-10-21  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/92162
+       * gcc.dg/pr92162.c: New testcase.
+
 2019-10-21  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/92161
diff --git a/gcc/testsuite/gcc.dg/pr92162.c b/gcc/testsuite/gcc.dg/pr92162.c
new file mode 100644 (file)
index 0000000..ed82595
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+short int s8;
+
+void __attribute__ ((simd))
+gn (void)
+{
+  s8 = 0;
+}
index 9efb797cb77b37c17b614ba58aa65c9b18c7184c..a4c9f2f4138432ef87c6269e8386ace3313a7d90 100644 (file)
@@ -4259,9 +4259,9 @@ vect_create_epilog_for_reduction (stmt_vec_info stmt_info,
         (CCOMPARE).  The then and else values mirror the main VEC_COND_EXPR:
         the reduction phi corresponds to NEW_PHI_TREE and the new values
         correspond to INDEX_BEFORE_INCR.  */
-      gcc_assert (STMT_VINFO_REDUC_IDX (stmt_info) >= 1);
+      gcc_assert (STMT_VINFO_REDUC_IDX (reduc_info) >= 1);
       tree index_cond_expr;
-      if (STMT_VINFO_REDUC_IDX (stmt_info) == 2)
+      if (STMT_VINFO_REDUC_IDX (reduc_info) == 2)
        index_cond_expr = build3 (VEC_COND_EXPR, cr_index_vector_type,
                                  ccompare, indx_before_incr, new_phi_tree);
       else
index 4c5d33ce952ad13ad66cc77a74502649a71b9e3d..7f6100e0ec603420e5e2c9e8d7a5e54e63afad4d 100644 (file)
@@ -9818,7 +9818,7 @@ vectorizable_condition (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
        return false;
       reduc_info = info_for_reduction (stmt_info);
       reduction_type = STMT_VINFO_REDUC_TYPE (reduc_info);
-      reduc_index = STMT_VINFO_REDUC_IDX (stmt_info);
+      reduc_index = STMT_VINFO_REDUC_IDX (reduc_info);
       gcc_assert (reduction_type != EXTRACT_LAST_REDUCTION
                  || reduc_index != -1);
     }