From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by sourceware.org (Postfix) with ESMTP id A0A3B3857C67 for ; Thu, 23 Jul 2020 20:19:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A0A3B3857C67 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=segher@kernel.crashing.org Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 06NKJ00S018505; Thu, 23 Jul 2020 15:19:00 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 06NKJ0pl018504; Thu, 23 Jul 2020 15:19:00 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Thu, 23 Jul 2020 15:19:00 -0500 From: Segher Boessenkool To: Jeff Law , Peter Bergner Cc: Pat Haugen , GCC Patches , David Edelsohn Subject: Re: [PATCH] rs6000: Disable -fcaller-saves by default Message-ID: <20200723201900.GH32057@gate.crashing.org> References: <8cc18935-a9aa-513f-eef2-154130b70a3b@linux.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, TXREP, T_SPF_HELO_PERMERROR, T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jul 2020 20:19:02 -0000 Hi! On Thu, Jul 23, 2020 at 01:42:59PM -0600, Jeff Law wrote: > On Thu, 2020-07-23 at 14:25 -0500, Pat Haugen via Gcc-patches wrote: > > Disable -fcaller-saves by default. > > > > This patch turns off -fcaller-saves by default so that IRA doesn't try > > to use volatile regs for pseudos that are live across a call, which > > would then require LRA to save/restore the reg around the call. > > 2020-07-23 Pat Haugen > > > > gcc/ > > * common/config/rs6000/rs6000-common.c > > (rs6000_option_optimization_table): Turn off -fcaller-saves. > > > > gcc/testsuite/ > > * gcc.target/powerpc/caller-saves.c: New. > What's driving this change? Peter noticed IRA allocates stuff to volatile registers while it is life through a call, and then LRA has to correct that, not optimal. > IRA will do a cost/benefit analysis to see using call clobbered registers like > this is profitable or not. You're just turning the whole thing off. '-fcaller-saves' Enable allocation of values to registers that are clobbered by function calls, by emitting extra instructions to save and restore the registers around such calls. Such allocation is done only when it seems to result in better code. This option is always enabled by default on certain machines, usually those which have no call-preserved registers to use instead. So, given what Peter saw, the analysis when to do or not do this isn't as good as could be hoped for. > This can be particularly bad for performance if you have classes with no call > saved registers. Do we though? Well, "d" for vectors, but there shouldn't be insns that require that? Segher