From patchwork Wed Jun 30 16:53:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: PR middle-end/PR44706 (xalancbmk ICE) From: Jan Hubicka X-Patchwork-Id: 57441 Message-Id: <20100630165342.GK6233@kam.mff.cuni.cz> To: Richard Guenther Cc: Jan Hubicka , gcc-patches@gcc.gnu.org Date: Wed, 30 Jun 2010 18:53:42 +0200 Hi, since the testcase also shows branch prediction bug that I am testing patch for and that makes the testcase useless to test this particular code path, I decided to make artificial one for this patch. I will commit the xalanbmk one with the followup patch fixing the profile. This is variant of patch I comitted. Honza Index: ChangeLog =================================================================== --- ChangeLog (revision 161614) +++ ChangeLog (working copy) @@ -1,3 +1,9 @@ +2010-06-30 Jan Hubicka + + PR middle-end/PR44706 + * ipa-split (split_function): Refine conditions when to use DECL_RESULT + to return the value. + 2010-06-30 Michael Matz PR bootstrap/44699 Index: ipa-split.c =================================================================== --- ipa-split.c (revision 161597) +++ ipa-split.c (working copy) @@ -931,6 +931,13 @@ split_function (struct split_point *spli if (!VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))) { retval = DECL_RESULT (current_function_decl); + + /* We use temporary register to hold value when aggregate_value_p + is false. Similarly for DECL_BY_REFERENCE we must avoid extra + copy. */ + if (!aggregate_value_p (retval, TREE_TYPE (current_function_decl)) + && !DECL_BY_REFERENCE (retval)) + retval = create_tmp_reg (TREE_TYPE (retval), NULL); if (is_gimple_reg (retval)) retval = make_ssa_name (retval, call); gimple_call_set_lhs (call, retval); Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 161614) +++ testsuite/ChangeLog (working copy) @@ -1,3 +1,7 @@ +2010-06-30 Jan Hubicka + + * gcc.dg/tree-ssa/ipa-split-4.c: New testcase. + 2010-06-30 Michael Matz PR bootstrap/44699 Index: testsuite/gcc.dg/tree-ssa/ipa-split-4.c =================================================================== --- testsuite/gcc.dg/tree-ssa/ipa-split-4.c (revision 0) +++ testsuite/gcc.dg/tree-ssa/ipa-split-4.c (revision 0) @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-fnsplit" } */ +int make_me_big (void); + +int +split_me (int a) +{ + if (__builtin_expect(a<10, 1)) + { + abort (); + } + else + { + make_me_big (); + make_me_big (); + make_me_big (); + make_me_big (); + return a+1; + } +} + +main() +{ + return split_me (0)+split_me(1)+split_me(2); +} +/* { dg-final { scan-tree-dump-times "Splitting function" 1 "fnsplit"} } */ +/* { dg-final { cleanup-tree-dump "fnsplit" } } */