diff options
author | Richard Henderson <rth@redhat.com> | 2005-10-06 13:46:53 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-10-06 13:46:53 -0700 |
commit | e2f9fe4298d7cdf587430ecd096d5b3d6b214b76 (patch) | |
tree | b27cc11783abb4d2a33638ffa8c39cee31924335 /gcc/tree-inline.c | |
parent | 0c7c1604de7009d820bba46fb102b8d3f7d691da (diff) | |
download | gcc-e2f9fe4298d7cdf587430ecd096d5b3d6b214b76.tar.gz |
re PR tree-optimization/22237 (struct copy inlining generates overlapping memcpy)
PR tree-opt/22237
* tree-inline.c (declare_return_variable): Handle modify_dest not
being a DECL.
From-SVN: r105057
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index afec40df005..f22785c0e80 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1260,10 +1260,21 @@ declare_return_variable (inline_data *id, tree return_slot_addr, /* If the callee cannot possibly modify MODIFY_DEST, then we can reuse it as the result of the call directly. Don't do this if it would promote MODIFY_DEST to addressable. */ - else if (!TREE_STATIC (modify_dest) - && !TREE_ADDRESSABLE (modify_dest) - && !TREE_ADDRESSABLE (result)) - use_it = true; + else if (TREE_ADDRESSABLE (result)) + use_it = false; + else + { + tree base_m = get_base_address (modify_dest); + + /* If the base isn't a decl, then it's a pointer, and we don't + know where that's going to go. */ + if (!DECL_P (base_m)) + use_it = false; + else if (is_global_var (base_m)) + use_it = false; + else if (!TREE_ADDRESSABLE (base_m)) + use_it = true; + } if (use_it) { |