diff options
author | Richard Guenther <rguenther@suse.de> | 2010-04-16 13:21:38 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-04-16 13:21:38 +0000 |
commit | 12de635528ca31f29da55d2c2a86ca726cc59885 (patch) | |
tree | 640a4ede30c1f4cf1f9690d68ebfea15522967e3 /gcc/tree-nrv.c | |
parent | 6ab643b5a439320654d52b678e19bdf21995b1d8 (diff) | |
download | gcc-12de635528ca31f29da55d2c2a86ca726cc59885.zip gcc-12de635528ca31f29da55d2c2a86ca726cc59885.tar.gz gcc-12de635528ca31f29da55d2c2a86ca726cc59885.tar.bz2 |
re PR tree-optimization/43572 (FAIL: gfortran.dg/PR19872.f execution test; formatted read - wrong numbers)
2010-04-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43572
* tree-ssa-alias.h (call_may_clobber_ref_p): Declare.
* tree-ssa-alias.c (call_may_clobber_ref_p): Export.
* tree-flow.h (is_call_clobbered): Remove.
* tree-flow-inline.h (is_call_clobbered): Likewise.
* tree-dfa.c (dump_variable): Do not dump call clobber state.
* tree-nrv.c (dest_safe_for_nrv_p): Use the alias oracle.
(execute_return_slot_opt): Adjust.
* tree-tailcall.c (suitable_for_tail_opt_p): Remove
check for call clobbered vars here.
(find_tail_calls): Move tailcall verification to the
proper place.
* gcc.dg/tree-ssa/tailcall-5.c: New testcase.
From-SVN: r158418
Diffstat (limited to 'gcc/tree-nrv.c')
-rw-r--r-- | gcc/tree-nrv.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c index b85c5a7..c2e49d3 100644 --- a/gcc/tree-nrv.c +++ b/gcc/tree-nrv.c @@ -291,23 +291,21 @@ 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. - We search for a base VAR_DECL and look to see if it is call clobbered. - Note that we could do better, for example, by - attempting to doing points-to analysis on INDIRECT_REFs. */ + DEST is available if it is not clobbered by the call. */ static bool -dest_safe_for_nrv_p (tree dest) +dest_safe_for_nrv_p (gimple call) { - while (handled_component_p (dest)) - dest = TREE_OPERAND (dest, 0); + tree dest = gimple_call_lhs (call); - if (! SSA_VAR_P (dest)) + dest = get_base_address (dest); + if (! dest) return false; if (TREE_CODE (dest) == SSA_NAME) - dest = SSA_NAME_VAR (dest); + return true; - if (is_call_clobbered (dest)) + if (call_may_clobber_ref_p (call, dest)) return false; return true; @@ -346,8 +344,8 @@ execute_return_slot_opt (void) ) { /* Check if the location being assigned to is - call-clobbered. */ - slot_opt_p = dest_safe_for_nrv_p (gimple_call_lhs (stmt)); + clobbered by the call. */ + slot_opt_p = dest_safe_for_nrv_p (stmt); gimple_call_set_return_slot_opt (stmt, slot_opt_p); } } |