diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-17 05:56:15 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-17 05:56:15 +0000 |
commit | f259ef2dde37cdc1994ab89de4202de11db1758d (patch) | |
tree | fa16d409fa166f36caaced4b9b18b5c11655a10f /gcc/tree-ssa-forwprop.c | |
parent | f901aa342fec3c1daf7be7c1f6258571542389b1 (diff) | |
download | gcc-f259ef2dde37cdc1994ab89de4202de11db1758d.tar.gz |
2008-05-17 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r135459
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@135460 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 31322b65791..cf6cf04ac1b 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -234,8 +234,7 @@ get_prop_source_stmt (tree name, bool single_use_only, bool *single_use_p) /* We can look through pointer conversions in the search for a useful stmt for the comparison folding. */ rhs = GIMPLE_STMT_OPERAND (def_stmt, 1); - if ((TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + if (CONVERT_EXPR_P (rhs) && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME && POINTER_TYPE_P (TREE_TYPE (rhs)) && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0)))) @@ -299,8 +298,7 @@ can_propagate_from (tree def_stmt) then we can not apply optimizations as some targets require function pointers to be canonicalized and in this case this optimization could eliminate a necessary canonicalization. */ - if ((TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + if (CONVERT_EXPR_P (rhs) && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0))) && TREE_CODE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (rhs, 0)))) == FUNCTION_TYPE) @@ -586,8 +584,7 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt, a conversion to def_rhs type separate, though. */ if (TREE_CODE (lhs) == SSA_NAME && (rhs == name - || TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + || CONVERT_EXPR_P (rhs)) && useless_type_conversion_p (TREE_TYPE (rhs), TREE_TYPE (def_rhs))) { /* Only recurse if we don't deal with a single use. */ @@ -792,8 +789,7 @@ forward_propagate_addr_expr (tree name, tree rhs) if (result && TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 0)) == SSA_NAME && (TREE_CODE (use_rhs) == SSA_NAME - || ((TREE_CODE (use_rhs) == NOP_EXPR - || TREE_CODE (use_rhs) == CONVERT_EXPR) + || (CONVERT_EXPR_P (use_rhs) && TREE_CODE (TREE_OPERAND (use_rhs, 0)) == SSA_NAME))) { block_stmt_iterator bsi = bsi_for_stmt (use_stmt); @@ -832,8 +828,7 @@ forward_propagate_comparison (tree cond, tree stmt) /* Conversion of the condition result to another integral type. */ if (TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT - && (TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == CONVERT_EXPR - || TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == NOP_EXPR + && (CONVERT_EXPR_P (GIMPLE_STMT_OPERAND (use_stmt, 1)) || COMPARISON_CLASS_P (GIMPLE_STMT_OPERAND (use_stmt, 1)) || TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == TRUTH_NOT_EXPR) && INTEGRAL_TYPE_P (TREE_TYPE (GIMPLE_STMT_OPERAND (use_stmt, 0)))) @@ -842,8 +837,7 @@ forward_propagate_comparison (tree cond, tree stmt) tree rhs = GIMPLE_STMT_OPERAND (use_stmt, 1); /* We can propagate the condition into a conversion. */ - if (TREE_CODE (rhs) == CONVERT_EXPR - || TREE_CODE (rhs) == NOP_EXPR) + if (CONVERT_EXPR_P (rhs)) { /* Avoid using fold here as that may create a COND_EXPR with non-boolean condition as canonical form. */ @@ -1033,8 +1027,7 @@ tree_ssa_forward_propagate_single_use_vars (void) if (TREE_CODE (rhs) == ADDR_EXPR /* Handle pointer conversions on invariant addresses as well, as this is valid gimple. */ - || ((TREE_CODE (rhs) == NOP_EXPR - || TREE_CODE (rhs) == CONVERT_EXPR) + || (CONVERT_EXPR_P (rhs) && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR && POINTER_TYPE_P (TREE_TYPE (rhs)))) { |