diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-13 12:43:58 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-13 12:43:58 +0000 |
commit | 024fee2c369096e6fe6cde620243df5843893004 (patch) | |
tree | 68386939ae0852a77af25150e2d0cbfe60672811 /gcc/tree-ssa-pre.c | |
parent | 780bedc1ccae5ae85fb99afed8a1ac1cc598121b (diff) | |
download | gcc-024fee2c369096e6fe6cde620243df5843893004.tar.gz |
2012-09-13 Richard Guenther <rguenther@suse.de>
* tree-ssa-sccvn.h (enum vn_kind): New.
(vn_get_stmt_kind): Likewise.
* tree-ssa-sccvn.c (vn_get_stmt_kind): New function, adjust
ADDR_EXPR handling.
(visit_use): Use it.
* tree-ssa-pre.c (compute_avail): Likewise, simplify further.
* gcc.dg/tree-ssa/ssa-fre-37.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191253 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r-- | gcc/tree-ssa-pre.c | 60 |
1 files changed, 9 insertions, 51 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index 64dedb16842..ab9f2f467c3 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -3922,21 +3922,22 @@ compute_avail (void) bitmap_value_insert_into_set (AVAIL_OUT (block), e); } - if (gimple_has_side_effects (stmt) || stmt_could_throw_p (stmt)) + if (gimple_has_side_effects (stmt) + || stmt_could_throw_p (stmt) + || is_gimple_debug (stmt)) continue; + FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE) + add_to_exp_gen (block, op); + switch (gimple_code (stmt)) { case GIMPLE_RETURN: - FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE) - add_to_exp_gen (block, op); continue; case GIMPLE_CALL: { vn_reference_t ref; - unsigned int i; - vn_reference_op_t vro; pre_expr result = NULL; VEC(vn_reference_op_s, heap) *ops = NULL; @@ -3952,18 +3953,6 @@ compute_avail (void) if (!ref) continue; - for (i = 0; VEC_iterate (vn_reference_op_s, - ref->operands, i, - vro); i++) - { - if (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME) - add_to_exp_gen (block, vro->op0); - if (vro->op1 && TREE_CODE (vro->op1) == SSA_NAME) - add_to_exp_gen (block, vro->op1); - if (vro->op2 && TREE_CODE (vro->op2) == SSA_NAME) - add_to_exp_gen (block, vro->op2); - } - /* If the value of the call is not invalidated in this block until it is computed, add the expression to EXP_GEN. */ @@ -3988,28 +3977,19 @@ compute_avail (void) case GIMPLE_ASSIGN: { pre_expr result = NULL; - switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt))) + switch (vn_get_stmt_kind (stmt)) { - case tcc_unary: - case tcc_binary: - case tcc_comparison: + case VN_NARY: { vn_nary_op_t nary; - unsigned int i; - vn_nary_op_lookup_pieces (gimple_num_ops (stmt) - 1, gimple_assign_rhs_code (stmt), gimple_expr_type (stmt), gimple_assign_rhs1_ptr (stmt), &nary); - if (!nary) continue; - for (i = 0; i < nary->length; i++) - if (TREE_CODE (nary->op[i]) == SSA_NAME) - add_to_exp_gen (block, nary->op[i]); - /* If the NARY traps and there was a preceding point in the block that might not return avoid adding the nary to EXP_GEN. */ @@ -4024,31 +4004,15 @@ compute_avail (void) break; } - case tcc_declaration: - case tcc_reference: + case VN_REFERENCE: { vn_reference_t ref; - unsigned int i; - vn_reference_op_t vro; - vn_reference_lookup (gimple_assign_rhs1 (stmt), gimple_vuse (stmt), VN_WALK, &ref); if (!ref) continue; - for (i = 0; VEC_iterate (vn_reference_op_s, - ref->operands, i, - vro); i++) - { - if (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME) - add_to_exp_gen (block, vro->op0); - if (vro->op1 && TREE_CODE (vro->op1) == SSA_NAME) - add_to_exp_gen (block, vro->op1); - if (vro->op2 && TREE_CODE (vro->op2) == SSA_NAME) - add_to_exp_gen (block, vro->op2); - } - /* If the value of the reference is not invalidated in this block until it is computed, add the expression to EXP_GEN. */ @@ -4082,18 +4046,12 @@ compute_avail (void) } default: - /* For any other statement that we don't - recognize, simply add all referenced - SSA_NAMEs to EXP_GEN. */ - FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE) - add_to_exp_gen (block, op); continue; } get_or_alloc_expression_id (result); add_to_value (get_expr_value_id (result), result); bitmap_value_insert_into_set (EXP_GEN (block), result); - continue; } default: |