* [PATCH] Fix vectorizer ICE (PR tree-optimization/55831)
@ 2012-12-31 15:27 Jakub Jelinek
2012-12-31 16:01 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2012-12-31 15:27 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi!
The following testcase ICEs because get_initial_def_for_induction inserts
stmts before gsi_start_bb, which is wrong for basic blocks that start with
labels, as then the labels are in the middle of a basic block.
Ok for trunk?
2012-12-31 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/55831
* tree-vect-loop.c (get_initial_def_for_induction): Use
gsi_after_labels instead of gsi_start_bb.
* gcc.dg/pr55831.c: New test.
--- gcc/tree-vect-loop.c.jj 2012-11-27 14:33:14.000000000 +0100
+++ gcc/tree-vect-loop.c 2012-12-31 15:10:02.211716876 +0100
@@ -3406,7 +3406,7 @@ get_initial_def_for_induction (gimple iv
build1 (VIEW_CONVERT_EXPR, resvectype, induc_def), NULL_TREE);
induc_def = make_ssa_name (gimple_assign_lhs (new_stmt), new_stmt);
gimple_assign_set_lhs (new_stmt, induc_def);
- si = gsi_start_bb (bb);
+ si = gsi_after_labels (bb);
gsi_insert_before (&si, new_stmt, GSI_SAME_STMT);
set_vinfo_for_stmt (new_stmt,
new_stmt_vec_info (new_stmt, loop_vinfo, NULL));
--- gcc/testsuite/gcc.dg/pr55831.c.jj 2012-12-31 15:25:11.484514159 +0100
+++ gcc/testsuite/gcc.dg/pr55831.c 2012-12-31 15:13:35.000000000 +0100
@@ -0,0 +1,22 @@
+/* PR tree-optimization/55831 */
+/* { dg-do compile } */
+/* { dg-options "-O -fstrict-overflow -ftree-vectorize -Wno-unused-label" } */
+
+int g;
+short p, q;
+
+void
+f (void)
+{
+ short a = p, b = q, i;
+
+ if (a)
+ {
+ label:
+ for (i = 0; i < 8; i++)
+ b ^= a++;
+
+ if (!b)
+ g = 0;
+ }
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix vectorizer ICE (PR tree-optimization/55831)
2012-12-31 15:27 [PATCH] Fix vectorizer ICE (PR tree-optimization/55831) Jakub Jelinek
@ 2012-12-31 16:01 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2012-12-31 16:01 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Richard Biener, gcc-patches
On Mon, Dec 31, 2012 at 4:26 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> The following testcase ICEs because get_initial_def_for_induction inserts
> stmts before gsi_start_bb, which is wrong for basic blocks that start with
> labels, as then the labels are in the middle of a basic block.
>
> Ok for trunk?
Obvious indeed.
Thanks,
Richard.
> 2012-12-31 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/55831
> * tree-vect-loop.c (get_initial_def_for_induction): Use
> gsi_after_labels instead of gsi_start_bb.
>
> * gcc.dg/pr55831.c: New test.
>
> --- gcc/tree-vect-loop.c.jj 2012-11-27 14:33:14.000000000 +0100
> +++ gcc/tree-vect-loop.c 2012-12-31 15:10:02.211716876 +0100
> @@ -3406,7 +3406,7 @@ get_initial_def_for_induction (gimple iv
> build1 (VIEW_CONVERT_EXPR, resvectype, induc_def), NULL_TREE);
> induc_def = make_ssa_name (gimple_assign_lhs (new_stmt), new_stmt);
> gimple_assign_set_lhs (new_stmt, induc_def);
> - si = gsi_start_bb (bb);
> + si = gsi_after_labels (bb);
> gsi_insert_before (&si, new_stmt, GSI_SAME_STMT);
> set_vinfo_for_stmt (new_stmt,
> new_stmt_vec_info (new_stmt, loop_vinfo, NULL));
> --- gcc/testsuite/gcc.dg/pr55831.c.jj 2012-12-31 15:25:11.484514159 +0100
> +++ gcc/testsuite/gcc.dg/pr55831.c 2012-12-31 15:13:35.000000000 +0100
> @@ -0,0 +1,22 @@
> +/* PR tree-optimization/55831 */
> +/* { dg-do compile } */
> +/* { dg-options "-O -fstrict-overflow -ftree-vectorize -Wno-unused-label" } */
> +
> +int g;
> +short p, q;
> +
> +void
> +f (void)
> +{
> + short a = p, b = q, i;
> +
> + if (a)
> + {
> + label:
> + for (i = 0; i < 8; i++)
> + b ^= a++;
> +
> + if (!b)
> + g = 0;
> + }
> +}
>
> Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-31 16:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-31 15:27 [PATCH] Fix vectorizer ICE (PR tree-optimization/55831) Jakub Jelinek
2012-12-31 16:01 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).