summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-09 12:32:20 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-09 12:32:20 +0000
commit30fde35818f0096c22c9fe87f07f7f2c1b8ad877 (patch)
tree7d2129cd384ed49e7ccc4d5da76366ff0ada7d49 /gcc/tree-ssa-forwprop.c
parent5133fd21329f6ef577d4c15783a881ff3ab70f1a (diff)
downloadgcc-30fde35818f0096c22c9fe87f07f7f2c1b8ad877.tar.gz
2007-11-09 Richard Guenther <rguenther@suse.de>
PR tree-optimization/33604 * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Disregard changes in CV qualifiers of pointed to types for forward propagating ADDR_EXPRs. * tree-ssa-ccp.c (fold_stmt_r): Preserve volatileness of the original expression. * g++.dg/tree-ssa/pr33604.C: New testcase. * gcc.dg/pr32721.c: Adjust pattern. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130040 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 047d057bfc9..bacd34e7f4d 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -952,7 +952,15 @@ tree_ssa_forward_propagate_single_use_vars (void)
continue;
}
- if (TREE_CODE (rhs) == ADDR_EXPR)
+ if (TREE_CODE (rhs) == ADDR_EXPR
+ /* We can also disregard changes in CV qualifiers for
+ the dereferenced value. */
+ || ((TREE_CODE (rhs) == NOP_EXPR
+ || TREE_CODE (rhs) == CONVERT_EXPR)
+ && TREE_CODE (TREE_OPERAND (rhs, 0)) == ADDR_EXPR
+ && POINTER_TYPE_P (TREE_TYPE (rhs))
+ && useless_type_conversion_p (TREE_TYPE (TREE_TYPE (rhs)),
+ TREE_TYPE (TREE_TYPE (TREE_OPERAND (rhs, 0))))))
{
if (forward_propagate_addr_expr (lhs, rhs))
{