https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69241
--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Markus Trippelsdorf from comment #17) > (In reply to Jakub Jelinek from comment #16) > > Created attachment 37565 [details] > > gcc6-pr69241.patch > > > > So, it seems we have at least 3 different issues, the attached patch fixes > > two of them, there is one remaining somewhere in ipa-split.c. > > Your testcase from PR69649 still fails with the patch. I know. But fnsplit is a mess. I'd think if !split_part_set_retval, we have two different cases. If the split part really doesn't set the return value in any way and for DECL_BY_REFERENCE RESULT_DECL doesn't even use the corresponding default def SSA_NAME, it might be best to arrange for the *.part.* function to have void return value rather than returning the aggregate, but not sure how hard it would be to convince the cloning infrastructure about that. And for the case where the SSA_NAME is used, but it is not used inside of MEM_REF (then it is treated as nonssa use and split_part_set_retval is true), then perhaps consider_split should be smarter. Consider: struct A { A(); ~A (); }; void bar (A *) throw (); volatile int v; static inline A foo (bool x) { A a; if (x) { v++; v++; v++; v++; v++; bar (&a); } return a; } A bar (bool x) { return foo (x); } A baz (bool x) { return foo (x); } where at -O2 we currently give up on the partial inlining, because: Refused: need to pass non-param values That is: if (num_args != bitmap_count_bits (current->ssa_names_to_pass)) and the difference is the DECL_BY_REFERENCE RESULT_DECL default def SSA_NAME. Perhaps consider_split should take that into account and force split_part_set_retval in that case?