aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-sra.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-03-19 11:06:52 -0400
committerJason Merrill <jason@redhat.com>2020-03-19 21:47:28 -0400
commit94e2418780f1d13235f3e2e6e5c09dbe821c1ce3 (patch)
treeea07f1fcf672378cce0331e64ffdb78894a228e4 /gcc/tree-sra.c
parent3373d3e38eaf807573cd04150a12ab1e43035f4d (diff)
downloadgcc-94e2418780f1d13235f3e2e6e5c09dbe821c1ce3.zip
gcc-94e2418780f1d13235f3e2e6e5c09dbe821c1ce3.tar.gz
gcc-94e2418780f1d13235f3e2e6e5c09dbe821c1ce3.tar.bz2
c++: Avoid unnecessary empty class copy [94175].
A simple empty class copy is still simple when wrapped in a TARGET_EXPR, so we need to strip that as well. This change also exposed some unnecessary copies in return statements, which when returning by invisible reference led to <RETURN_EXPR <MEM_REF <RESULT_DECL>>>, which gimplify_return_expr didn't like. So we also need to strip the _REF when we eliminate the INIT_EXPR. gcc/cp/ChangeLog 2020-03-19 Jason Merrill <jason@redhat.com> PR c++/94175 * cp-gimplify.c (simple_empty_class_p): Look through SIMPLE_TARGET_EXPR_P. (cp_gimplify_expr) [MODIFY_EXPR]: Likewise. [RETURN_EXPR]: Avoid producing 'return *retval;'. * call.c (build_call_a): Strip TARGET_EXPR from empty class arg. * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL is non-null.
Diffstat (limited to 'gcc/tree-sra.c')
0 files changed, 0 insertions, 0 deletions