From patchwork Wed Jun 30 16:53:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 57441 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AC481B6F06 for ; Thu, 1 Jul 2010 02:54:00 +1000 (EST) Received: (qmail 3965 invoked by alias); 30 Jun 2010 16:53:58 -0000 Received: (qmail 3954 invoked by uid 22791); 30 Jun 2010 16:53:56 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, TW_NB, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam-dmz.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 Jun 2010 16:53:45 +0000 Received: from localhost (occam.ms.mff.cuni.cz [195.113.18.121]) by nikam.ms.mff.cuni.cz (Postfix) with ESMTP id DAC019AC8BB; Wed, 30 Jun 2010 18:53:42 +0200 (CEST) Received: by localhost (Postfix, from userid 16202) id D423056415F; Wed, 30 Jun 2010 18:53:42 +0200 (CEST) Date: Wed, 30 Jun 2010 18:53:42 +0200 From: Jan Hubicka To: Richard Guenther Cc: Jan Hubicka , gcc-patches@gcc.gnu.org Subject: Re: PR middle-end/PR44706 (xalancbmk ICE) Message-ID: <20100630165342.GK6233@kam.mff.cuni.cz> References: <20100630121448.GJ6233@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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" } } */