Commit c43ade80 by Martin Liska Committed by Martin Liska

Handle noreturn function thunk creation.

	PR ipa/64813
	* cgraphunit.c (cgraph_node::expand_thunk): Do not create
	a return value for call to a function that is noreturn.

From-SVN: r220616
parent ece70d33
2015-02-11 Martin Liska <mliska@suse.cz>
PR ipa/64813
* cgraphunit.c (cgraph_node::expand_thunk): Do not create
a return value for call to a function that is noreturn.
2015-02-11 Richard Biener <rguenther@suse.de> 2015-02-11 Richard Biener <rguenther@suse.de>
PR lto/65015 PR lto/65015
......
...@@ -1580,6 +1580,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) ...@@ -1580,6 +1580,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
gcall *call; gcall *call;
greturn *ret; greturn *ret;
bool alias_is_noreturn = TREE_THIS_VOLATILE (alias);
if (in_lto_p) if (in_lto_p)
get_untransformed_body (); get_untransformed_body ();
...@@ -1616,7 +1617,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) ...@@ -1616,7 +1617,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
bsi = gsi_start_bb (bb); bsi = gsi_start_bb (bb);
/* Build call to the function being thunked. */ /* Build call to the function being thunked. */
if (!VOID_TYPE_P (restype)) if (!VOID_TYPE_P (restype) && !alias_is_noreturn)
{ {
if (DECL_BY_REFERENCE (resdecl)) if (DECL_BY_REFERENCE (resdecl))
{ {
...@@ -1675,14 +1676,14 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk) ...@@ -1675,14 +1676,14 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
callees->call_stmt = call; callees->call_stmt = call;
gimple_call_set_from_thunk (call, true); gimple_call_set_from_thunk (call, true);
gimple_call_set_with_bounds (call, instrumentation_clone); gimple_call_set_with_bounds (call, instrumentation_clone);
if (restmp) if (restmp && !alias_is_noreturn)
{ {
gimple_call_set_lhs (call, restmp); gimple_call_set_lhs (call, restmp);
gcc_assert (useless_type_conversion_p (TREE_TYPE (restmp), gcc_assert (useless_type_conversion_p (TREE_TYPE (restmp),
TREE_TYPE (TREE_TYPE (alias)))); TREE_TYPE (TREE_TYPE (alias))));
} }
gsi_insert_after (&bsi, call, GSI_NEW_STMT); gsi_insert_after (&bsi, call, GSI_NEW_STMT);
if (!(gimple_call_flags (call) & ECF_NORETURN)) if (!alias_is_noreturn)
{ {
if (restmp && !this_adjusting if (restmp && !this_adjusting
&& (fixed_offset || virtual_offset)) && (fixed_offset || virtual_offset))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment