Commit 49f428c9 by Richard Biener Committed by Richard Biener

re PR tree-optimization/70725 (Internal compiler error (ICE) on valid code)

2016-04-21  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/70725
	* tree-if-conv.c (if_convertible_phi_p): Adjust guard
	for phi_convertible_by_degenerating_args.
	(predicate_all_scalar_phis): Handle single-argument PHIs.

From-SVN: r235341
parent c2bd3b69
2016-04-21 Richard Biener <rguenther@suse.de> 2016-04-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/70725
* tree-if-conv.c (if_convertible_phi_p): Adjust guard
for phi_convertible_by_degenerating_args.
(predicate_all_scalar_phis): Handle single-argument PHIs.
2016-04-21 Richard Biener <rguenther@suse.de>
PR middle-end/70747 PR middle-end/70747
* fold-const.c (fold_comparison): Return properly typed * fold-const.c (fold_comparison): Return properly typed
constant boolean. constant boolean.
......
...@@ -659,7 +659,7 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, gphi *phi, ...@@ -659,7 +659,7 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, gphi *phi,
if (bb != loop->header) if (bb != loop->header)
{ {
if (gimple_phi_num_args (phi) != 2 if (gimple_phi_num_args (phi) > 2
&& !aggressive_if_conv && !aggressive_if_conv
&& !phi_convertible_by_degenerating_args (phi)) && !phi_convertible_by_degenerating_args (phi))
{ {
...@@ -1911,20 +1911,31 @@ predicate_all_scalar_phis (struct loop *loop) ...@@ -1911,20 +1911,31 @@ predicate_all_scalar_phis (struct loop *loop)
if (bb == loop->header) if (bb == loop->header)
continue; continue;
if (EDGE_COUNT (bb->preds) == 1)
continue;
phi_gsi = gsi_start_phis (bb); phi_gsi = gsi_start_phis (bb);
if (gsi_end_p (phi_gsi)) if (gsi_end_p (phi_gsi))
continue; continue;
gsi = gsi_after_labels (bb); if (EDGE_COUNT (bb->preds) == 1)
while (!gsi_end_p (phi_gsi))
{ {
phi = phi_gsi.phi (); /* Propagate degenerate PHIs. */
predicate_scalar_phi (phi, &gsi); for (phi_gsi = gsi_start_phis (bb); !gsi_end_p (phi_gsi);
release_phi_node (phi); gsi_next (&phi_gsi))
gsi_next (&phi_gsi); {
gphi *phi = phi_gsi.phi ();
replace_uses_by (gimple_phi_result (phi),
gimple_phi_arg_def (phi, 0));
}
}
else
{
gsi = gsi_after_labels (bb);
while (!gsi_end_p (phi_gsi))
{
phi = phi_gsi.phi ();
predicate_scalar_phi (phi, &gsi);
release_phi_node (phi);
gsi_next (&phi_gsi);
}
} }
set_phi_nodes (bb, NULL); set_phi_nodes (bb, NULL);
......
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