From patchwork Thu Dec 20 11:41:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 1016731 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-492881-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="YvNF4gPw"; dkim-atps=neutral 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 43L8yw3dlmz9rxp for ; Thu, 20 Dec 2018 22:43:20 +1100 (AEDT) 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=kVdMKGZwn2l/Cekc /iAtdXD8KOcHVDriJm4gJZR0uhqLng13kfTNJ79d5jqoEo5yiUE5EdbFkkZKgVHq Qz3LI5rT/mREVYwTPJKXl+HuuspUZzM9cSutWGwCmcmlX8AfqlDKVpoePqZtodYA KsPjOEiKWj7E0cNGdfhjPU8aJwQ= 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=BItYeJUEgQVQcVSEzFJDfJ Q4FpE=; b=YvNF4gPwTCwGdnnZqKZtVFPPbFvje2GiCtDp5I7OUrUXjnZbgm8UWQ /MNa6IyB6aYLGGy++15ZtmOxm1xewrX9jlKvvHK+7FAKEhJD9wfSvAVTKwarmnVN w61yObup1399x4sKRsHnwNWb85f8YipPWIo7esDwELlEBKkGvZ/RU= Received: (qmail 39743 invoked by alias); 20 Dec 2018 11:43:13 -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 39731 invoked by uid 89); 20 Dec 2018 11:43:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=U*ebotcazou, basket X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 20 Dec 2018 11:43:11 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 766D081396 for ; Thu, 20 Dec 2018 12:43:09 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zRBeliZgyRf3 for ; Thu, 20 Dec 2018 12:43:09 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 58653812EF for ; Thu, 20 Dec 2018 12:43:09 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix PR rtl-optimization/87727 Date: Thu, 20 Dec 2018 12:41:16 +0100 Message-ID: <3499484.ePniFpkjG6@polaris> MIME-Version: 1.0 Hi, this is a regression introduced on the SPARC by the somewhat controversial combiner change for hard registers: the compiler can no longer apply the leaf registers optimization to a small function so a register window is now used. The combiner change might be an overall win, but my understanding is that it's dependent on the target and SPARC seems to be in the wrong basket: almost all changes to the gcc.c-torture/compile testsuite at -O2 are pessimizations in the form of additional move instructions between registers on function entry. Clearly that's counter-productive for a LEAF_REGISTERS target like SPARC so the proposed fix is to re-enable hard register combining for leaf registers. Tested on SPARC/Solaris 11, OK for the mainline? 2018-12-20 Eric Botcazou PR rtl-optimization/87727 * combine.c (cant_combine_insn_p): On a LEAF_REGISTERS target, combine again moves from leaf hard registers. Index: combine.c =================================================================== --- combine.c (revision 267029) +++ combine.c (working copy) @@ -2349,7 +2349,12 @@ cant_combine_insn_p (rtx_insn *insn) dest = SUBREG_REG (dest); if (REG_P (src) && REG_P (dest) && ((HARD_REGISTER_P (src) - && ! TEST_HARD_REG_BIT (fixed_reg_set, REGNO (src))) + && ! TEST_HARD_REG_BIT (fixed_reg_set, REGNO (src)) +#ifdef LEAF_REGISTERS + && ! LEAF_REGISTERS [REGNO (src)]) +#else + ) +#endif || (HARD_REGISTER_P (dest) && ! TEST_HARD_REG_BIT (fixed_reg_set, REGNO (dest)) && targetm.class_likely_spilled_p (REGNO_REG_CLASS (REGNO (dest))))))