diff options
author | Jeff Law <law@redhat.com> | 2004-05-14 11:51:05 -0600 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 2004-05-14 11:51:05 -0600 |
commit | 14bc8dc2806a4dae14ec1fa052fb319cf92c2085 (patch) | |
tree | bc5a65b08d1433084d256e36182e0a2524cf09f1 /gcc/tree-ssa-dom.c | |
parent | 394ef95eafc76d2b28c833cec76984953f3308d3 (diff) | |
download | gcc-14bc8dc2806a4dae14ec1fa052fb319cf92c2085.zip gcc-14bc8dc2806a4dae14ec1fa052fb319cf92c2085.tar.gz gcc-14bc8dc2806a4dae14ec1fa052fb319cf92c2085.tar.bz2 |
tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Reorganize so that it picks up more opportunities to eliminate ABS expressions...
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Reorganize
so that it picks up more opportunities to eliminate ABS expressions
or turn them into negations.
* gcc.dg/tree-ssa/20040514-2.c: New test.
From-SVN: r81853
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r-- | gcc/tree-ssa-dom.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index ed47ea6..89f4c6a 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -1826,7 +1826,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data, if (! dummy_cond) { - dummy_cond = build (LT_EXPR, boolean_type_node, + dummy_cond = build (LE_EXPR, boolean_type_node, op, integer_zero_node); dummy_cond = build (COND_EXPR, void_type_node, dummy_cond, NULL, NULL); @@ -1834,7 +1834,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data, } else { - TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), LT_EXPR); + TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), LE_EXPR); TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 0) = op; TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 1) = convert (type, integer_zero_node); @@ -1842,6 +1842,26 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data, val = simplify_cond_and_lookup_avail_expr (dummy_cond, &bd->avail_exprs, NULL, false); + + if (!val) + { + TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), GE_EXPR); + TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 0) = op; + TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 1) + = convert (type, integer_zero_node); + + val = simplify_cond_and_lookup_avail_expr (dummy_cond, + &bd->avail_exprs, + NULL, false); + + if (val) + { + if (integer_zerop (val)) + val = integer_one_node; + else if (integer_onep (val)) + val = integer_zero_node; + } + } } if (val |