Fix recent tree-if-conv ICE (PR tree-optimization/89268)

Message ID 20190209231612.GV2135@tucnak
State New
Headers show
Series
  • Fix recent tree-if-conv ICE (PR tree-optimization/89268)
Related show

Commit Message

Jakub Jelinek Feb. 9, 2019, 11:16 p.m.
Hi!

WHen tree_if_conversion is called from within the vectorizer (for masked
epilogues), preds is NULL, so we shouldn't be pushing anything there,
the caller doesn't care anyway.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2019-02-09  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/89268
	* tree-if-conv.c (version_loop_for_if_conversion): Push to preds only
	if preds is non-NULL.

	* gcc.dg/vect/pr89268.c: New test.


	Jakub

Comments

Richard Biener Feb. 10, 2019, 6:44 a.m. | #1
On February 10, 2019 12:16:12 AM GMT+01:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!

>

>WHen tree_if_conversion is called from within the vectorizer (for

>masked

>epilogues), preds is NULL, so we shouldn't be pushing anything there,

>the caller doesn't care anyway.


Oops. 

>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?


OK. 

Richard. 

>2019-02-09  Jakub Jelinek  <jakub@redhat.com>

>

>	PR tree-optimization/89268

>	* tree-if-conv.c (version_loop_for_if_conversion): Push to preds only

>	if preds is non-NULL.

>

>	* gcc.dg/vect/pr89268.c: New test.

>

>--- gcc/tree-if-conv.c.jj	2019-02-08 20:00:40.774827920 +0100

>+++ gcc/tree-if-conv.c	2019-02-09 17:35:36.995782510 +0100

>@@ -2760,7 +2760,8 @@ version_loop_for_if_conversion (struct l

>   new_loop->force_vectorize = false;

>   gsi = gsi_last_bb (cond_bb);

>gimple_call_set_arg (g, 1, build_int_cst (integer_type_node,

>new_loop->num));

>-  preds->safe_push (g);

>+  if (preds)

>+    preds->safe_push (g);

>   gsi_insert_before (&gsi, g, GSI_SAME_STMT);

>   update_ssa (TODO_update_ssa);

>   return new_loop;

>--- gcc/testsuite/gcc.dg/vect/pr89268.c.jj	2019-02-09

>17:53:15.099481437 +0100

>+++ gcc/testsuite/gcc.dg/vect/pr89268.c	2019-02-09 17:53:50.900896069

>+0100

>@@ -0,0 +1,7 @@

>+/* PR tree-optimization/89268 */

>+/* { dg-do compile } */

>+/* { dg-require-effective-target vect_condition } */

>+/* { dg-additional-options "-fno-trapping-math --param

>vect-epilogues-nomask=1" } */

>+/* { dg-additional-options "-mavx512ifma -mtune=intel" { target

>x86_64-*-* i?86-*-* } } */

>+

>+#include "pr79887.c"

>

>	Jakub

Patch

--- gcc/tree-if-conv.c.jj	2019-02-08 20:00:40.774827920 +0100
+++ gcc/tree-if-conv.c	2019-02-09 17:35:36.995782510 +0100
@@ -2760,7 +2760,8 @@  version_loop_for_if_conversion (struct l
   new_loop->force_vectorize = false;
   gsi = gsi_last_bb (cond_bb);
   gimple_call_set_arg (g, 1, build_int_cst (integer_type_node, new_loop->num));
-  preds->safe_push (g);
+  if (preds)
+    preds->safe_push (g);
   gsi_insert_before (&gsi, g, GSI_SAME_STMT);
   update_ssa (TODO_update_ssa);
   return new_loop;
--- gcc/testsuite/gcc.dg/vect/pr89268.c.jj	2019-02-09 17:53:15.099481437 +0100
+++ gcc/testsuite/gcc.dg/vect/pr89268.c	2019-02-09 17:53:50.900896069 +0100
@@ -0,0 +1,7 @@ 
+/* PR tree-optimization/89268 */
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_condition } */
+/* { dg-additional-options "-fno-trapping-math --param vect-epilogues-nomask=1" } */
+/* { dg-additional-options "-mavx512ifma -mtune=intel" { target x86_64-*-* i?86-*-* } } */
+
+#include "pr79887.c"