diff options
author | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-03-26 10:33:36 +0000 |
---|---|---|
committer | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-03-26 10:33:36 +0000 |
commit | a63f89638edc7c3120e52faf6815bfe3e9b270e2 (patch) | |
tree | 61b7552b10852929b89f1cb93878fadffc1885c2 /gcc/tree-ssa-sccvn.c | |
parent | 9402409a6bd0d7d1f7358793f768bda3ec8a9574 (diff) | |
parent | 087a99ba8749638f86c111f776ed326b3fbd97c0 (diff) | |
download | gcc-cxx-conversion.tar.gz |
Merged revisions 196607-196608,196611-196614,196625,196629-196634,196636,196639,196645-196647,196649-196650,196654-196659,196666,196669,196671-196675,196682-196683,196694-196695,196697-196698,196700-196701,196704-196706,196709,196721-196748,196750-196751,196753,196755-196758,196762,196764-196765,196767-196771,196773-196779,196781-196784,196788-196792,196795-196797,196799-196800,196804-196807,196810-196814,196821,196823-196825,196828-196829,196831-196832,196834,196841-196842,196847-196853,196855-196856,196858,196860-196861,196864-196866,196868,196870-196872,196874,196876,196878-196879,196882,196884-196890,196896-196897,196899-196902,196954,196956-196961,196964-196965,196970,196977-196978,196981-196983,196989,197002-197005,197007,197011-197012,197016-197019,197021,197023-197025,197029-197034,197036-197042 via svnmerge from cxx-conversion
svn+ssh://gcc.gnu.org/svn/gcc/trunk
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/cxx-conversion@197098 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 2609f668942..07bfdcccb81 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2715,18 +2715,13 @@ static tree valueize_expr (tree expr); static bool visit_copy (tree lhs, tree rhs) { - /* Follow chains of copies to their destination. */ - while (TREE_CODE (rhs) == SSA_NAME - && SSA_VAL (rhs) != rhs) - rhs = SSA_VAL (rhs); - /* The copy may have a more interesting constant filled expression (we don't, since we know our RHS is just an SSA name). */ - if (TREE_CODE (rhs) == SSA_NAME) - { - VN_INFO (lhs)->has_constants = VN_INFO (rhs)->has_constants; - VN_INFO (lhs)->expr = VN_INFO (rhs)->expr; - } + VN_INFO (lhs)->has_constants = VN_INFO (rhs)->has_constants; + VN_INFO (lhs)->expr = VN_INFO (rhs)->expr; + + /* And finally valueize. */ + rhs = SSA_VAL (rhs); return set_ssa_val_to (lhs, rhs); } @@ -3125,25 +3120,38 @@ expr_has_constants (tree expr) static bool stmt_has_constants (gimple stmt) { + tree tem; + if (gimple_code (stmt) != GIMPLE_ASSIGN) return false; switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))) { - case GIMPLE_UNARY_RHS: - return is_gimple_min_invariant (gimple_assign_rhs1 (stmt)); + case GIMPLE_TERNARY_RHS: + tem = gimple_assign_rhs3 (stmt); + if (TREE_CODE (tem) == SSA_NAME) + tem = SSA_VAL (tem); + if (is_gimple_min_invariant (tem)) + return true; + /* Fallthru. */ case GIMPLE_BINARY_RHS: - return (is_gimple_min_invariant (gimple_assign_rhs1 (stmt)) - || is_gimple_min_invariant (gimple_assign_rhs2 (stmt))); - case GIMPLE_TERNARY_RHS: - return (is_gimple_min_invariant (gimple_assign_rhs1 (stmt)) - || is_gimple_min_invariant (gimple_assign_rhs2 (stmt)) - || is_gimple_min_invariant (gimple_assign_rhs3 (stmt))); + tem = gimple_assign_rhs2 (stmt); + if (TREE_CODE (tem) == SSA_NAME) + tem = SSA_VAL (tem); + if (is_gimple_min_invariant (tem)) + return true; + /* Fallthru. */ + case GIMPLE_SINGLE_RHS: /* Constants inside reference ops are rarely interesting, but it can take a lot of looking to find them. */ - return is_gimple_min_invariant (gimple_assign_rhs1 (stmt)); + case GIMPLE_UNARY_RHS: + tem = gimple_assign_rhs1 (stmt); + if (TREE_CODE (tem) == SSA_NAME) + tem = SSA_VAL (tem); + return is_gimple_min_invariant (tem); + default: gcc_unreachable (); } @@ -3561,8 +3569,13 @@ visit_use (tree use) We can value number 2 calls to the same function with the same vuse and the same operands which are not subsequent the same, because there is no code in the program that can - compare the 2 values. */ - || gimple_vdef (stmt))) + compare the 2 values... */ + || (gimple_vdef (stmt) + /* ... unless the call returns a pointer which does + not alias with anything else. In which case the + information that the values are distinct are encoded + in the IL. */ + && !(gimple_call_return_flags (stmt) & ERF_NOALIAS)))) changed = visit_reference_op_call (lhs, stmt); else changed = defs_to_varying (stmt); |