aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-03-20 22:06:40 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-03-20 22:06:40 +0000
commit16ac8575504420eb56680d82edbd6c8879a67faf (patch)
treebd5e138f1c805a2f582aec0ad63aaaa70c10283c /gcc/tree-ssa-forwprop.c
parent44b6c5465840c7cd4737c0a0bc434c38dfa4eca4 (diff)
downloadgcc-16ac8575504420eb56680d82edbd6c8879a67faf.zip
gcc-16ac8575504420eb56680d82edbd6c8879a67faf.tar.gz
gcc-16ac8575504420eb56680d82edbd6c8879a67faf.tar.bz2
tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Remove special casing of constant qualifiers.
2008-03-20 Richard Guenther <rguenther@suse.de> * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Remove special casing of constant qualifiers. * tree-ssa.c (useless_type_conversion_p_1): Instead do not care about them in general. * tree-ssa-ccp.c (ccp_fold): Addresses are constant or not regardless of their type. (fold_stmt_r): Forcefully fold *& if we end up with that. * gcc.dg/tree-ssa/ssa-ccp-17.c: New testcase. From-SVN: r133400
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 84553fb..e6402ad 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -601,14 +601,8 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt,
propagate the ADDR_EXPR into the use of NAME and fold the result. */
if (TREE_CODE (lhs) == INDIRECT_REF
&& TREE_OPERAND (lhs, 0) == name
- /* This will not allow stripping const qualification from
- pointers which we want to allow specifically here to clean up
- the IL for initialization of constant objects. */
- && (useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (lhs, 0)),
- TREE_TYPE (def_rhs))
- /* So explicitly check for this here. */
- || (TYPE_QUALS (TREE_TYPE (TREE_TYPE (TREE_OPERAND (lhs, 0))))
- ^ TYPE_QUALS (TREE_TYPE (TREE_TYPE (def_rhs)))) == TYPE_QUAL_CONST)
+ && useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (lhs, 0)),
+ TREE_TYPE (def_rhs))
/* ??? This looks redundant, but is required for bogus types
that can sometimes occur. */
&& useless_type_conversion_p (TREE_TYPE (lhs),
@@ -635,13 +629,10 @@ forward_propagate_addr_expr_1 (tree name, tree def_rhs, tree use_stmt,
propagate the ADDR_EXPR into the use of NAME and fold the result. */
if (TREE_CODE (rhs) == INDIRECT_REF
&& TREE_OPERAND (rhs, 0) == name
- /* ??? This doesn't allow stripping const qualification to
- streamline the IL for reads from non-constant objects. */
- && (useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (rhs, 0)),
- TREE_TYPE (def_rhs))
- /* So explicitly check for this here. */
- || (TYPE_QUALS (TREE_TYPE (TREE_TYPE (TREE_OPERAND (rhs, 0))))
- ^ TYPE_QUALS (TREE_TYPE (TREE_TYPE (def_rhs)))) == TYPE_QUAL_CONST)
+ && useless_type_conversion_p (TREE_TYPE (TREE_OPERAND (rhs, 0)),
+ TREE_TYPE (def_rhs))
+ /* ??? This looks redundant, but is required for bogus types
+ that can sometimes occur. */
&& useless_type_conversion_p (TREE_TYPE (rhs),
TREE_TYPE (TREE_OPERAND (def_rhs, 0))))
{