summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-27 15:00:37 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-27 15:00:37 +0000
commit9481f629582b23ee6714e4843c21b721e0a6dc91 (patch)
treecc1f0441b801657e05c602bbd03a41eaade69aec /gcc/tree-ssa-forwprop.c
parentaeaacbf3a7da89011425b99003a6db333f48adf9 (diff)
downloadgcc-9481f629582b23ee6714e4843c21b721e0a6dc91.tar.gz
2007-11-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/34241 * tree-ssa-forwprop.c (forward_propagate_addr_expr): Make sure to only delete real conversion chains. * g++.dg/torture/pr34241.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130468 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 3e30454ab9f..f368c3321c4 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -685,6 +685,7 @@ forward_propagate_addr_expr (tree name, tree rhs)
FOR_EACH_IMM_USE_STMT (use_stmt, iter, name)
{
bool result;
+ tree use_rhs;
/* If the use is not in a simple assignment statement, then
there is nothing we can do. */
@@ -712,11 +713,13 @@ forward_propagate_addr_expr (tree name, tree rhs)
pop_stmt_changes (&use_stmt);
/* Remove intermediate now unused copy and conversion chains. */
+ use_rhs = GIMPLE_STMT_OPERAND (use_stmt, 1);
if (result
&& TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 0)) == SSA_NAME
- && (TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == SSA_NAME
- || TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == NOP_EXPR
- || TREE_CODE (GIMPLE_STMT_OPERAND (use_stmt, 1)) == CONVERT_EXPR))
+ && (TREE_CODE (use_rhs) == SSA_NAME
+ || ((TREE_CODE (use_rhs) == NOP_EXPR
+ || TREE_CODE (use_rhs) == CONVERT_EXPR)
+ && TREE_CODE (TREE_OPERAND (use_rhs, 0)) == SSA_NAME)))
{
block_stmt_iterator bsi = bsi_for_stmt (use_stmt);
release_defs (use_stmt);