aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-nrv.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-07-26 16:01:55 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-07-26 16:01:55 +0000
commit7f8ac3d7f9914527dbc0052d21326bc351f211e9 (patch)
tree4dd9226e46cf61e9b8b0ed19dc32773d0e0121c8 /gcc/tree-nrv.c
parent6a2ba1839d6cbcde7424e9c10a200d19d34beeb8 (diff)
downloadgcc-7f8ac3d7f9914527dbc0052d21326bc351f211e9.zip
gcc-7f8ac3d7f9914527dbc0052d21326bc351f211e9.tar.gz
gcc-7f8ac3d7f9914527dbc0052d21326bc351f211e9.tar.bz2
re PR tree-optimization/43784 (-Os -fkeep-inline-functions causes FAIL: gcc.c-torture/execute/builtins/pr22237.c execution)
2010-07-26 Richard Guenther <rguenther@suse.de> PR tree-optimization/43784 * tree-nrv.c (dest_safe_for_nrv_p): It's not safe to NRV if the destination is used by the call. * gcc.c-torture/execute/pr43784.c: New testcase. * g++.dg/torture/pr43784.C: Likewise. From-SVN: r162539
Diffstat (limited to 'gcc/tree-nrv.c')
-rw-r--r--gcc/tree-nrv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c
index 2f40d56..8ee3b8b 100644
--- a/gcc/tree-nrv.c
+++ b/gcc/tree-nrv.c
@@ -296,7 +296,7 @@ struct gimple_opt_pass pass_nrv =
optimization, where DEST is expected to be the LHS of a modify
expression where the RHS is a function returning an aggregate.
- DEST is available if it is not clobbered by the call. */
+ DEST is available if it is not clobbered or used by the call. */
static bool
dest_safe_for_nrv_p (gimple call)
@@ -310,7 +310,8 @@ dest_safe_for_nrv_p (gimple call)
if (TREE_CODE (dest) == SSA_NAME)
return true;
- if (call_may_clobber_ref_p (call, dest))
+ if (call_may_clobber_ref_p (call, dest)
+ || ref_maybe_used_by_stmt_p (call, dest))
return false;
return true;
@@ -345,8 +346,7 @@ execute_return_slot_opt (void)
&& gimple_call_lhs (stmt)
&& !gimple_call_return_slot_opt_p (stmt)
&& aggregate_value_p (TREE_TYPE (gimple_call_lhs (stmt)),
- gimple_call_fndecl (stmt))
- )
+ gimple_call_fndecl (stmt)))
{
/* Check if the location being assigned to is
clobbered by the call. */