diff options
author | Richard Guenther <rguenther@suse.de> | 2011-05-30 13:12:23 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-05-30 13:12:23 +0000 |
commit | 42b05b6e884f5b14c3433f12593fe6accae5becf (patch) | |
tree | 375b1b02da555fc6f5d11e49aff1e203d4746314 /gcc/ipa-split.c | |
parent | 8a8c12a3cd7b8905616680d458249f2ec865396c (diff) | |
download | gcc-42b05b6e884f5b14c3433f12593fe6accae5becf.zip gcc-42b05b6e884f5b14c3433f12593fe6accae5becf.tar.gz gcc-42b05b6e884f5b14c3433f12593fe6accae5becf.tar.bz2 |
re PR middle-end/49210 (verify_gimple fails building ada/einfo.o at -O3)
2011-05-30 Richard Guenther <rguenther@suse.de>
PR tree-optimization/49210
* ipa-split.c (split_function): Care for the case where the
call result is not trivially convertible to the result holding
variable.
* gnat.dg/boolean_subtype2.adb: New testcase.
* gnat.dg/boolean_subtype2.ads: Likewise.
* gnat.dg/boolean_subtype2_pkg.ads: Likewise.
From-SVN: r174435
Diffstat (limited to 'gcc/ipa-split.c')
-rw-r--r-- | gcc/ipa-split.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c index 9579d41..2e67287 100644 --- a/gcc/ipa-split.c +++ b/gcc/ipa-split.c @@ -1196,11 +1196,31 @@ split_function (struct split_point *split_point) } } if (DECL_BY_REFERENCE (DECL_RESULT (current_function_decl))) - gimple_call_set_lhs (call, build_simple_mem_ref (retval)); + { + gimple_call_set_lhs (call, build_simple_mem_ref (retval)); + gsi_insert_after (&gsi, call, GSI_NEW_STMT); + } else - gimple_call_set_lhs (call, retval); + { + tree restype; + restype = TREE_TYPE (DECL_RESULT (current_function_decl)); + gsi_insert_after (&gsi, call, GSI_NEW_STMT); + if (!useless_type_conversion_p (TREE_TYPE (retval), restype)) + { + gimple cpy; + tree tem = create_tmp_reg (restype, NULL); + tem = make_ssa_name (tem, call); + cpy = gimple_build_assign_with_ops (NOP_EXPR, retval, + tem, NULL_TREE); + gsi_insert_after (&gsi, cpy, GSI_NEW_STMT); + retval = tem; + } + gimple_call_set_lhs (call, retval); + update_stmt (call); + } } - gsi_insert_after (&gsi, call, GSI_NEW_STMT); + else + gsi_insert_after (&gsi, call, GSI_NEW_STMT); } /* We don't use return block (there is either no return in function or multiple of them). So create new basic block with return statement. |