From patchwork Mon Aug 29 16:50:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Segher Boessenkool X-Patchwork-Id: 663739 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sNHhh5Krjz9s9G for ; Tue, 30 Aug 2016 02:50:30 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=AtfWeYaA; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=X267w5y5ZgYv pc/bCIxGPntcrqnRCT9SoaCq9ZULwWg5Wxz4RS/XOYOdYp5dWD+x4Y1k/9x+hhLK WoclU6H/etXw1tThODgOszBvOXqAgi5g1p3SLEGMYVZeFstejFhbdPl+fOi2izxj x2cq6O0AFvylK1Rb3LwsUYtZeYf5r0Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=eByPPXTbyF7QQUsSL6 9MCu0p5KQ=; b=AtfWeYaAZwqMuZCjX2fwPwuQMCT1jjh6PhFLa5EhSD5FViVu3q nTat/y9Ebx6yPLDcI9gjXgAeeBIyoOZyiws5flKuwdlXZQEKCsE/xYyJXIJTZohq 4v7Z5T47+BMgY9FokpBpAw/Z5gqdubhnlZ4a/dDFQeL5+C3crNZkFVlLo= Received: (qmail 107294 invoked by alias); 29 Aug 2016 16:50:22 -0000 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 Received: (qmail 107283 invoked by uid 89); 29 Aug 2016 16:50:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, UNSUBSCRIBE_BODY autolearn=no version=3.3.2 spammy=H*Ad:U*bonzini, LIVE, deeper, dfscanc X-HELO: gcc1-power7.osuosl.org Received: from gcc1-power7.osuosl.org (HELO gcc1-power7.osuosl.org) (140.211.15.137) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 29 Aug 2016 16:50:11 +0000 Received: by gcc1-power7.osuosl.org (Postfix, from userid 10019) id 555ED1C06DD; Mon, 29 Aug 2016 16:50:05 +0000 (UTC) From: Segher Boessenkool To: gcc-patches@gcc.gnu.org Cc: bonzini@gnu.org, seongbae.park@gmail.com, zadeck@naturalbridge.com, Segher Boessenkool Subject: [PATCH] df: Keep return address register undefined until epilogue_completed Date: Mon, 29 Aug 2016 16:50:02 +0000 Message-Id: X-IsSubscribed: yes For separate shrink-wrapping we need to find out which basic blocks need what components set up by a prologue, so that we can move those prologue pieces deeper into the function, so that those pieces are executed less frequently, improving performance. To do this, target code will normally look at the LIVE info: a block needs a register set up if that register is in the IN, GEN, or KILL sets. This works fine for the callee-saved registers, since those are not in entry_block_defs, but it does not work for the rs6000 link register, because df_get_entry_block_def_set unconditinally adds the register that is INCOMING_RETURN_ADDR_RTX (if it is a register). This patch changes that so that that def is only added after epilogue_completed. With that, in the rs6000 backend we can use the same IN+GEN+KILL condition to see whether LR is used (in the current patch set, only KILL is used, which isn't correct; the backend can write to LR to temporarily hold other values; a crazy idea, on modern hardware anyway, but it does regardless). Does this work on all other targets? Should anything else be done? Segher 2016-08-29 Segher Boessenkool * df-scan.c (df_get_entry_block_def_set): Do not add the INCOMING_RETURN_ADDR_RTX register until epilogue_completed. --- gcc/df-scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/df-scan.c b/gcc/df-scan.c index 9cd647a..ea94f37 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -3567,7 +3567,7 @@ df_get_entry_block_def_set (bitmap entry_block_defs) } #ifdef INCOMING_RETURN_ADDR_RTX - if (REG_P (INCOMING_RETURN_ADDR_RTX)) + if (REG_P (INCOMING_RETURN_ADDR_RTX) && epilogue_completed) bitmap_set_bit (entry_block_defs, REGNO (INCOMING_RETURN_ADDR_RTX)); #endif