summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-21 14:09:33 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-21 14:09:33 +0000
commit2a4df976d8e5325166508a992c7643fdfef63d16 (patch)
tree5fabcb4e1b5cda6c5491fe891edb73df02f559ce
parent310a96199554e5e10bdde3b91ae7be2c42f8935b (diff)
downloadgcc-2a4df976d8e5325166508a992c7643fdfef63d16.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235341 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/tree-if-conv.c31
2 files changed, 28 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 50d13cb2fe3..4ad22d8fce6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
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
* fold-const.c (fold_comparison): Return properly typed
constant boolean.
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 04a1d3e536d..2d14901316e 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -659,7 +659,7 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, gphi *phi,
if (bb != loop->header)
{
- if (gimple_phi_num_args (phi) != 2
+ if (gimple_phi_num_args (phi) > 2
&& !aggressive_if_conv
&& !phi_convertible_by_degenerating_args (phi))
{
@@ -1911,20 +1911,31 @@ predicate_all_scalar_phis (struct loop *loop)
if (bb == loop->header)
continue;
- if (EDGE_COUNT (bb->preds) == 1)
- continue;
-
phi_gsi = gsi_start_phis (bb);
if (gsi_end_p (phi_gsi))
continue;
- gsi = gsi_after_labels (bb);
- while (!gsi_end_p (phi_gsi))
+ if (EDGE_COUNT (bb->preds) == 1)
{
- phi = phi_gsi.phi ();
- predicate_scalar_phi (phi, &gsi);
- release_phi_node (phi);
- gsi_next (&phi_gsi);
+ /* Propagate degenerate PHIs. */
+ for (phi_gsi = gsi_start_phis (bb); !gsi_end_p (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);