aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-06-13 22:58:13 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-06-13 22:58:13 +0000
commit1d24fdd92a0189c05fedccebfdfb696fee999a4d (patch)
tree8ff0bc85b42906f5dd2e481e0620be0c340e16de /gcc/gimple.c
parent4b29c5e5434f7aaaabd4b6f314139fde5803b513 (diff)
downloadgcc-1d24fdd92a0189c05fedccebfdfb696fee999a4d.zip
gcc-1d24fdd92a0189c05fedccebfdfb696fee999a4d.tar.gz
gcc-1d24fdd92a0189c05fedccebfdfb696fee999a4d.tar.bz2
re PR c++/40389 (optimizer bug (possibly))
2009-06-14 Richard Guenther <rguenther@suse.de> PR middle-end/40389 * gimple.c (walk_stmt_load_store_addr_ops): The LHS of a call has its address taken if NRV was applied and it is addressable. * tree-ssa-structalias.c (get_constraint_for_address_of): New function split out from ... (get_constraint_for_1): ... here. (handle_rhs_call): Use it to mark the return slot escaped if it is addressable and NRV was applied. * g++.dg/torture/pr40389.C: New testcase. From-SVN: r148462
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index d3578da..24727bc 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -3264,6 +3264,11 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
&& TREE_CODE (gimple_call_chain (stmt)) == ADDR_EXPR)
ret |= visit_addr (stmt, TREE_OPERAND (gimple_call_chain (stmt), 0),
data);
+ if (visit_addr
+ && gimple_call_return_slot_opt_p (stmt)
+ && gimple_call_lhs (stmt) != NULL_TREE
+ && TREE_ADDRESSABLE (gimple_call_lhs (stmt)))
+ ret |= visit_addr (stmt, gimple_call_lhs (stmt), data);
}
else if (gimple_code (stmt) == GIMPLE_ASM)
{