From b7aa4a3ab319b307daf896c274557443593acbd5 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Sat, 28 Feb 2015 21:32:15 +0100 Subject: re PR ipa/65236 (IPA ICF causes miscompilation in Chromium built with -Os) PR ipa/65236 * g++.dg/ipa/ipa-icf-6.C: New testcase. * cgraphunit.c (cgraph_node::expand_thunk): Enable return slot opt. From-SVN: r221077 --- gcc/cgraphunit.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/cgraphunit.c') diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 9f6878a..e640907 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -1680,6 +1680,14 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) callees->call_stmt = call; gimple_call_set_from_thunk (call, true); gimple_call_set_with_bounds (call, instrumentation_clone); + + /* Return slot optimization is always possible and in fact requred to + return values with DECL_BY_REFERENCE. */ + if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl)) + && (!is_gimple_reg_type (TREE_TYPE (resdecl)) + || DECL_BY_REFERENCE (resdecl))) + gimple_call_set_return_slot_opt (call, true); + if (restmp && !alias_is_noreturn) { gimple_call_set_lhs (call, restmp); -- cgit v1.1