diff options
author | Richard Biener <rguenther@suse.de> | 2016-08-13 08:04:46 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-08-13 08:04:46 +0000 |
commit | 30c8821b37f20d584c0c11618d5d1787d44961c8 (patch) | |
tree | 8037fa2ccfb72a14c6220f22d6faf7c2b45297f3 /gcc | |
parent | 82b709f9c4c9b21761a44a08db43524efa40dcd5 (diff) | |
download | gcc-30c8821b37f20d584c0c11618d5d1787d44961c8.zip gcc-30c8821b37f20d584c0c11618d5d1787d44961c8.tar.gz gcc-30c8821b37f20d584c0c11618d5d1787d44961c8.tar.bz2 |
tree-ssa-forwprop.c (pass_forwprop::execute): Propagate into PHIs and update the lattice for its def.
2016-08-13 Richard Biener <rguenther@suse.de>
* tree-ssa-forwprop.c (pass_forwprop::execute): Propagate
into PHIs and update the lattice for its def.
From-SVN: r239444
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 29 |
2 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index db6138d..a3ffe87 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-08-13 Richard Biener <rguenther@suse.de> + + * tree-ssa-forwprop.c (pass_forwprop::execute): Propagate + into PHIs and update the lattice for its def. + 2016-08-12 Jakub Jelinek <jakub@redhat.com> PR c/71512 diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index c40f9e2..736b841 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -2107,6 +2107,35 @@ pass_forwprop::execute (function *fun) gimple_stmt_iterator gsi; basic_block bb = BASIC_BLOCK_FOR_FN (fun, postorder[i]); + /* Propagate into PHIs and record degenerate ones in the lattice. */ + for (gphi_iterator si = gsi_start_phis (bb); !gsi_end_p (si); + gsi_next (&si)) + { + gphi *phi = si.phi (); + tree res = gimple_phi_result (phi); + if (virtual_operand_p (res)) + continue; + + use_operand_p use_p; + ssa_op_iter it; + tree first = NULL_TREE; + bool all_same = true; + FOR_EACH_PHI_ARG (use_p, phi, it, SSA_OP_USE) + { + tree use = USE_FROM_PTR (use_p); + tree tem = fwprop_ssa_val (use); + if (! first) + first = tem; + else if (! operand_equal_p (first, tem, 0)) + all_same = false; + if (tem != use + && may_propagate_copy (use, tem)) + propagate_value (use_p, tem); + } + if (all_same) + fwprop_set_lattice_val (res, first); + } + /* Apply forward propagation to all stmts in the basic-block. Note we update GSI within the loop as necessary. */ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); ) |