diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2004-11-29 01:08:41 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2004-11-28 20:08:41 -0500 |
commit | 9390c347e9f2ac5dc3a97933f537c1576a310f4e (patch) | |
tree | b482d08649ec8d47fb095b9196547e3f66709af8 /gcc/tree-ssa-operands.c | |
parent | ab1a8620fc5bef59dec0bb8b7b41cea4132435d5 (diff) | |
download | gcc-9390c347e9f2ac5dc3a97933f537c1576a310f4e.tar.gz |
tree-ssa-operands.c (build_ssa_operands, [...]): Ignore a VIEW_CONVERT_EXPR on LHS when deciding if must or may def.
PR/18664
* tree-ssa-operands.c (build_ssa_operands, case MODIFY_EXPR):
Ignore a VIEW_CONVERT_EXPR on LHS when deciding if must or may def.
* tree-ssa-ccp.c (visit_assignment): If LHS is a VIEW_CONVERT_EXPR,
add an inverse VIEW_CONVERT_EXPR to const_val.
From-SVN: r91450
Diffstat (limited to 'gcc/tree-ssa-operands.c')
-rw-r--r-- | gcc/tree-ssa-operands.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 94a83d0184b..f8d70156aba 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -893,20 +893,33 @@ build_ssa_operands (tree stmt, stmt_ann_t ann, stmt_operands_p old_ops, switch (code) { case MODIFY_EXPR: - get_expr_operands (stmt, &TREE_OPERAND (stmt, 1), opf_none); - if (TREE_CODE (TREE_OPERAND (stmt, 0)) == ARRAY_REF - || TREE_CODE (TREE_OPERAND (stmt, 0)) == ARRAY_RANGE_REF - || TREE_CODE (TREE_OPERAND (stmt, 0)) == COMPONENT_REF - || TREE_CODE (TREE_OPERAND (stmt, 0)) == REALPART_EXPR - || TREE_CODE (TREE_OPERAND (stmt, 0)) == IMAGPART_EXPR - /* Use a V_MAY_DEF if the RHS might throw, as the LHS won't be - modified in that case. FIXME we should represent somehow - that it is killed on the fallthrough path. */ - || tree_could_throw_p (TREE_OPERAND (stmt, 1))) - get_expr_operands (stmt, &TREE_OPERAND (stmt, 0), opf_is_def); - else - get_expr_operands (stmt, &TREE_OPERAND (stmt, 0), - opf_is_def | opf_kill_def); + /* First get operands from the RHS. For the LHS, we use a V_MAY_DEF if + either only part of LHS is modified or if the RHS might throw, + otherwise, use V_MUST_DEF. + + ??? If it might throw, we should represent somehow that it is killed + on the fallthrough path. */ + { + tree lhs = TREE_OPERAND (stmt, 0); + int lhs_flags = opf_is_def; + + get_expr_operands (stmt, &TREE_OPERAND (stmt, 1), opf_none); + + /* If the LHS is a VIEW_CONVERT_EXPR, it isn't changing whether + or not the entire LHS is modified; that depends on what's + inside the VIEW_CONVERT_EXPR. */ + if (TREE_CODE (lhs) == VIEW_CONVERT_EXPR) + lhs = TREE_OPERAND (lhs, 0); + + if (TREE_CODE (lhs) != ARRAY_REF && TREE_CODE (lhs) != ARRAY_RANGE_REF + && TREE_CODE (lhs) != COMPONENT_REF + && TREE_CODE (lhs) != BIT_FIELD_REF + && TREE_CODE (lhs) != REALPART_EXPR + && TREE_CODE (lhs) != IMAGPART_EXPR) + lhs_flags |= opf_kill_def; + + get_expr_operands (stmt, &TREE_OPERAND (stmt, 0), lhs_flags); + } break; case COND_EXPR: |