diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2015-02-28 21:32:15 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-02-28 20:32:15 +0000 |
commit | b7aa4a3ab319b307daf896c274557443593acbd5 (patch) | |
tree | b1b16f1a1567b6bacad4d0f21597b2a83c80b5cf /gcc/cgraphunit.c | |
parent | f083b434c27face3cdf13c0f5b089d3f651956f3 (diff) | |
download | gcc-b7aa4a3ab319b307daf896c274557443593acbd5.zip gcc-b7aa4a3ab319b307daf896c274557443593acbd5.tar.gz gcc-b7aa4a3ab319b307daf896c274557443593acbd5.tar.bz2 |
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
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r-- | gcc/cgraphunit.c | 8 |
1 files changed, 8 insertions, 0 deletions
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); |