From patchwork Tue Oct 12 12:17:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 46130 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E56E03857438 for ; Tue, 12 Oct 2021 12:17:51 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 48C5F3858430 for ; Tue, 12 Oct 2021 12:17:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 48C5F3858430 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0D6FF220E3 for ; Tue, 12 Oct 2021 12:17:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1634041054; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QHeYg9fSmY1KfT+2iiVDjpPvcWfftIeV2NZ0PqSgsYk=; b=f9pPHhDyj3YXblt3CQnTm8x2PzOYkc4jRXjlDUD1596kLhM2/tvLcDjW/MGZCRgebaYSoQ 3GOXQY7AvZKbn8qdzE1OkhdnfZmkp+eb0dYydQ0EwuaRHxvNRHhQwLq9mFfAAzoxLrsPM8 Zh9HWYXo55za/U6PaWPmBHdwVI8lpYQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1634041054; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QHeYg9fSmY1KfT+2iiVDjpPvcWfftIeV2NZ0PqSgsYk=; b=Gi9aZPdsOUoBCF3RyphpA4mNxZJb/U8PjNqNBOlxm37POEbXygOQdaDDReOmi08f5hg3Pp hRqIv49KZZl30oBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EF76D13B6F for ; Tue, 12 Oct 2021 12:17:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IT41Od18ZWHyPgAAMHmgww (envelope-from ) for ; Tue, 12 Oct 2021 12:17:33 +0000 Message-ID: <12fd0c18-79e0-d20d-2973-92639071c050@suse.cz> Date: Tue, 12 Oct 2021 14:17:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] Fix handling of flag_rename_registers. To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hello. The option is disabled in rs6000 target with: { OPT_LEVELS_ALL, OPT_frename_registers, NULL, 0 }, Thus, we have to do an auto-detection only if it's really unset and also equal to the Init value. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. And the problematic test-case works on ppc64le. Ready to be installed? Thanks, Martin PR target/102688 gcc/ChangeLog: * common.opt: Enable flag_rename_registers by default. * toplev.c (process_options): Auto-detect flag_rename_registers only if it is not turned off in a target. --- gcc/common.opt | 2 +- gcc/toplev.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/common.opt b/gcc/common.opt index 4099effcc80..2c6be1bdd36 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -2399,7 +2399,7 @@ Common Var(flag_live_range_shrinkage) Init(0) Optimization Relief of register pressure through live range shrinkage. frename-registers -Common Var(flag_rename_registers) Optimization +Common Var(flag_rename_registers) Init(1) Optimization Perform a register renaming optimization pass. fschedule-fusion diff --git a/gcc/toplev.c b/gcc/toplev.c index 167feac2583..ee7d8854f90 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1335,7 +1335,8 @@ process_options (bool no_backend) if (!OPTION_SET_P (flag_web)) flag_web = flag_unroll_loops; - if (!OPTION_SET_P (flag_rename_registers)) + /* The option can be turned off in a target. */ + if (!OPTION_SET_P (flag_rename_registers) && flag_rename_registers) flag_rename_registers = flag_unroll_loops; if (flag_non_call_exceptions)