Commit 7fea20f6 by Richard Biener Committed by Richard Biener

re PR tree-optimization/84178 (ICE in release_bb_predicate)

2018-03-08  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/84178
	* tree-if-conv.c (combine_blocks): Move insert_gimplified_predicates
	to caller.
	(version_loop_for_if_conversion): Delay update_ssa call.
	(tree_if_conversion): Delay update_ssa until after predicate
	insertion.

	* gcc.dg/torture/pr84178-2.c: New testcase.

From-SVN: r258364
parent 8b9a03d6
2018-03-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/84178
* tree-if-conv.c (combine_blocks): Move insert_gimplified_predicates
to caller.
(version_loop_for_if_conversion): Delay update_ssa call.
(tree_if_conversion): Delay update_ssa until after predicate
insertion.
2018-03-08 David Malcolm <dmalcolm@redhat.com> 2018-03-08 David Malcolm <dmalcolm@redhat.com>
PR tree-optimization/84178 PR tree-optimization/84178
......
2018-03-08 Richard Biener <rguenther@suse.de>
PR tree-optimization/84178
* gcc.dg/torture/pr84178-2.c: New testcase.
2018-03-08 David Malcolm <dmalcolm@redhat.com> 2018-03-08 David Malcolm <dmalcolm@redhat.com>
PR tree-optimization/84178 PR tree-optimization/84178
......
/* { dg-do compile } */
/* { dg-additional-options "-fno-tree-forwprop" } */
int zy, h4;
void
r8 (long int mu, int *jr, int *fi, short int dv)
{
do
{
int tx;
tx = !!h4 ? (zy + h4) : 1;
mu = tx;
*jr = (((unsigned char) mu > (254 >> dv)) ? 0 : (unsigned char) tx) + *fi;
} while (*jr == 0);
r8 (mu, jr, fi, 1);
}
...@@ -2371,7 +2371,6 @@ combine_blocks (struct loop *loop) ...@@ -2371,7 +2371,6 @@ combine_blocks (struct loop *loop)
edge_iterator ei; edge_iterator ei;
remove_conditions_and_labels (loop); remove_conditions_and_labels (loop);
insert_gimplified_predicates (loop);
predicate_all_scalar_phis (loop); predicate_all_scalar_phis (loop);
if (any_pred_load_store) if (any_pred_load_store)
...@@ -2593,7 +2592,6 @@ version_loop_for_if_conversion (struct loop *loop) ...@@ -2593,7 +2592,6 @@ version_loop_for_if_conversion (struct loop *loop)
gsi = gsi_last_bb (cond_bb); gsi = gsi_last_bb (cond_bb);
gimple_call_set_arg (g, 1, build_int_cst (integer_type_node, new_loop->num)); gimple_call_set_arg (g, 1, build_int_cst (integer_type_node, new_loop->num));
gsi_insert_before (&gsi, g, GSI_SAME_STMT); gsi_insert_before (&gsi, g, GSI_SAME_STMT);
update_ssa (TODO_update_ssa);
return new_loop; return new_loop;
} }
...@@ -2811,6 +2809,7 @@ tree_if_conversion (struct loop *loop) ...@@ -2811,6 +2809,7 @@ tree_if_conversion (struct loop *loop)
unsigned int todo = 0; unsigned int todo = 0;
bool aggressive_if_conv; bool aggressive_if_conv;
struct loop *rloop; struct loop *rloop;
bool need_update_ssa = false;
again: again:
rloop = NULL; rloop = NULL;
...@@ -2856,6 +2855,7 @@ tree_if_conversion (struct loop *loop) ...@@ -2856,6 +2855,7 @@ tree_if_conversion (struct loop *loop)
struct loop *nloop = version_loop_for_if_conversion (vloop); struct loop *nloop = version_loop_for_if_conversion (vloop);
if (nloop == NULL) if (nloop == NULL)
goto cleanup; goto cleanup;
need_update_ssa = true;
if (vloop != loop) if (vloop != loop)
{ {
/* If versionable_outer_loop_p decided to version the /* If versionable_outer_loop_p decided to version the
...@@ -2880,6 +2880,13 @@ tree_if_conversion (struct loop *loop) ...@@ -2880,6 +2880,13 @@ tree_if_conversion (struct loop *loop)
} }
} }
/* Due to hard to fix issues we end up with immediate uses recorded
for not yet inserted predicates which will confuse SSA update so
we delayed this from after versioning to after predicate insertion. */
insert_gimplified_predicates (loop);
if (need_update_ssa)
update_ssa (TODO_update_ssa);
/* Now all statements are if-convertible. Combine all the basic /* Now all statements are if-convertible. Combine all the basic
blocks into one huge basic block doing the if-conversion blocks into one huge basic block doing the if-conversion
on-the-fly. */ on-the-fly. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment