From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 51218 invoked by alias); 18 Sep 2018 14:56:21 -0000 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 Received: (qmail 51208 invoked by uid 89); 18 Sep 2018 14:56:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=2433210, H*i:sk:2045800, 24332,6, 243326 X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 18 Sep 2018 14:56:19 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w8IEuB95014257; Tue, 18 Sep 2018 09:56:11 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id w8IEuARr014240; Tue, 18 Sep 2018 09:56:10 -0500 Date: Tue, 18 Sep 2018 15:26:00 -0000 From: Segher Boessenkool To: Eric Botcazou Cc: gcc-patches@gcc.gnu.org Subject: Re: [rs6000] Do not generate sibling call to nested function Message-ID: <20180918145610.GS23155@gate.crashing.org> References: <2045800.G86V45WoCa@polaris> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2045800.G86V45WoCa@polaris> User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00995.txt.bz2 Hi! On Mon, Sep 17, 2018 at 11:11:53AM +0200, Eric Botcazou wrote: > more precisely, to a nested function that requires a static chain. The reason > is that the sibling call epilogue may clobber the static chain register r11. > > Tested on PowerPC/Linux, OK for the mainline? > > > 2018-09-17 Eric Botcazou > > * config/rs6000/rs6000.c (rs6000_function_ok_for_sibcall): Return false > if the call takes a static chain. > --- config/rs6000/rs6000.c (revision 264342) > +++ config/rs6000/rs6000.c (working copy) > @@ -24332,6 +24332,10 @@ rs6000_function_ok_for_sibcall (tree dec > { > tree fntype; > > + /* The sibcall epilogue may clobber the static chain register. */ > + if (CALL_EXPR_STATIC_CHAIN (exp)) > + return false; > + > if (decl) > fntype = TREE_TYPE (decl); > else We could probably make sibcalls work with static chain, but that is most likely not worth it. Could you change the comment to say something like that? Approved for trunk and backports. Thanks! Segher