diff options
author | Richard Biener <rguenther@suse.de> | 2015-04-21 12:52:43 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-04-21 12:52:43 +0000 |
commit | 0ff093d85530159d74f77edc0da5d8bd176fe953 (patch) | |
tree | 2360651c91e90b4d553f511d0ad13639ea0d08ca /gcc/gimple-fold.c | |
parent | 9588d24871d34967389a1396e3df16c61eacd54c (diff) | |
download | gcc-0ff093d85530159d74f77edc0da5d8bd176fe953.zip gcc-0ff093d85530159d74f77edc0da5d8bd176fe953.tar.gz gcc-0ff093d85530159d74f77edc0da5d8bd176fe953.tar.bz2 |
re PR tree-optimization/65650 (CCP does not propgate copies)
2015-04-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/65650
* tree-ssa-ccp.c (valid_lattice_transition): Allow lattice
transitions involving copies.
(set_lattice_value): Adjust for copy lattice state.
(ccp_lattice_meet): Do not merge UNDEFINED and a copy to the copy
if that doesn't dominate the merge point.
(bit_value_unop): Adjust what we treat as varying mask.
(bit_value_binop): Likewise.
(bit_value_assume_aligned): Likewise.
(evaluate_stmt): When we simplified to a SSA name record a copy
instead of dropping to varying.
(visit_assignment): Simplify.
* gimple-match.h (gimple_simplify): Add another callback.
* gimple-fold.c (fold_stmt_1): Adjust caller.
(gimple_fold_stmt_to_constant_1): Likewise - pass valueize
for the 2nd callback.
* gimple-match-head.c (gimple_simplify): Add a callback that is
used to valueize the stmt operands and use it that way.
* gcc.dg/tree-ssa/ssa-ccp-37.c: New testcase.
* gcc.dg/tree-ssa/forwprop-11.c: Adjust.
* gcc.dg/tree-ssa/ssa-fre-3.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-4.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-5.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-32.c: Likewise.
From-SVN: r222267
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index d607e8f..2cc5628 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -3621,7 +3621,8 @@ fold_stmt_1 (gimple_stmt_iterator *gsi, bool inplace, tree (*valueize) (tree)) gimple_seq seq = NULL; code_helper rcode; tree ops[3] = {}; - if (gimple_simplify (stmt, &rcode, ops, inplace ? NULL : &seq, valueize)) + if (gimple_simplify (stmt, &rcode, ops, inplace ? NULL : &seq, + valueize, valueize)) { if (replace_stmt_with_simplification (gsi, rcode, ops, &seq, inplace)) changed = true; @@ -4928,7 +4929,7 @@ gimple_fold_stmt_to_constant_1 (gimple stmt, tree (*valueize) (tree), edges if there are intermediate VARYING defs. For this reason do not follow SSA edges here even though SCCVN can technically just deal fine with that. */ - if (gimple_simplify (stmt, &rcode, ops, NULL, gvalueize) + if (gimple_simplify (stmt, &rcode, ops, NULL, gvalueize, valueize) && rcode.is_tree_code () && (TREE_CODE_LENGTH ((tree_code) rcode) == 0 || ((tree_code) rcode) == ADDR_EXPR) |