summaryrefslogtreecommitdiff
path: root/gcc/ipa-split.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-30 13:12:23 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-30 13:12:23 +0000
commit9ece8f578eb4b2cd255d6e289dd5b9f871f5d2af (patch)
tree375b1b02da555fc6f5d11e49aff1e203d4746314 /gcc/ipa-split.c
parent58d3add9e305234ff16cd65f54ec6113dacb724b (diff)
downloadgcc-9ece8f578eb4b2cd255d6e289dd5b9f871f5d2af.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174435 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-split.c')
-rw-r--r--gcc/ipa-split.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 9579d41f18b..2e672874024 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.