From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5344 invoked by alias); 1 Apr 2011 14:49:27 -0000 Received: (qmail 5336 invoked by uid 22791); 1 Apr 2011 14:49:26 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Apr 2011 14:49:22 +0000 Received: (qmail 9007 invoked from network); 1 Apr 2011 14:49:22 -0000 Received: from unknown (HELO ?192.168.1.66?) (vries@127.0.0.2) by mail.codesourcery.com with ESMTPA; 1 Apr 2011 14:49:22 -0000 Message-ID: <4D95E5F0.1030104@codesourcery.com> Date: Fri, 01 Apr 2011 14:49:00 -0000 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org, ebotcazou@libertysurf.fr Subject: Re: [PATCH, PR43920, 5/9] Cross-jumping - Add missing use of return register. References: <4D94C603.7080505@codesourcery.com> <4D94C88B.4020206@codesourcery.com> <4D94CA95.4080309@codesourcery.com> In-Reply-To: <4D94CA95.4080309@codesourcery.com> Content-Type: multipart/mixed; boundary="------------000509070303010408060303" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg00037.txt.bz2 This is a multi-part message in MIME format. --------------000509070303010408060303 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 27 Reposting, with ChangeLog. --------------000509070303010408060303 Content-Type: text/x-patch; name="5_crossjump-use-return-register-ml.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="5_crossjump-use-return-register-ml.patch" Content-length: 1866 2011-04-01 Tom de Vries PR target/43920 * function.c (emit_use_return_register_into_block): New function. (thread_prologue_and_epilogue_insns): Use emit_use_return_register_into_block. Index: gcc/function.c =================================================================== --- gcc/function.c (revision 170556) +++ gcc/function.c (working copy) @@ -5241,6 +5241,19 @@ prologue_epilogue_contains (const_rtx in return 0; } +/* Insert use of return register before the end of BB. */ + +static void +emit_use_return_register_into_block (basic_block bb) +{ + rtx seq; + start_sequence (); + use_return_register (); + seq = get_insns (); + end_sequence (); + emit_insn_before (seq, BB_END (bb)); +} + #ifdef HAVE_return /* Insert gen_return at the end of block BB. This also means updating block_for_insn appropriately. */ @@ -5395,6 +5408,15 @@ thread_prologue_and_epilogue_insns (void with a simple return instruction. */ if (simplejump_p (jump)) { + /* The use of the return register might be present in the exit + fallthru block. Either: + - removing the use is safe, and we should remove the use in + the exit fallthru block, or + - removing the use is not safe, and we should add it here. + For now, we conservatively choose the latter. Either of the + 2 helps in crossjumping. */ + emit_use_return_register_into_block (bb); + emit_return_into_block (bb); delete_insn (jump); } @@ -5409,6 +5431,9 @@ thread_prologue_and_epilogue_insns (void continue; } + /* See comment in simple_jump_p case above. */ + emit_use_return_register_into_block (bb); + /* If this block has only one successor, it both jumps and falls through to the fallthru block, so we can't delete the edge. */ --------------000509070303010408060303--