From patchwork Tue Jun 25 09:23:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 1952005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=XKXAptqL; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W7fYF69Ngz20X1 for ; Tue, 25 Jun 2024 19:24:33 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AAABC3858CDB for ; Tue, 25 Jun 2024 09:24:31 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id 52807386C5BC for ; Tue, 25 Jun 2024 09:24:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 52807386C5BC Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=baylibre.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 52807386C5BC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::229 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719307445; cv=none; b=YlYX3hmnyQhQicxJRBzJ+E6n19vSoOZQ1HmN9SVWJNh+mNGbyzwlc9EGScZL/Xd8RFlrdc+h9B/rqUFieqeislnfv4ZD8UiEolsklFaZ1VixAOLsd30TtilQEghaWPyi9ljHFbUL6xbvymrPxgNVGkQ4pFkv5XS/cWy18oK9iq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719307445; c=relaxed/simple; bh=/gddlvkvrdgItam80ivS54Nziof3GYbKJ2AlibaEz1I=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Tm/FgT0UyXLo/A7lBYMj4WaA0pKAhfBAkHACJkfcScA7d9MgJbD0GrqClmxr2IECNWNCGQrEUUcOhJVu9JE7PIt/PkiXh948G/LIlnx/COZ7GAeUBkMuegRWDh7CO5tcPrObSEf8Li0Y7/3UiP9388dx3nmGbdWxnDCtolmSf38= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2ebeefb9a6eso59590701fa.1 for ; Tue, 25 Jun 2024 02:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1719307441; x=1719912241; darn=gcc.gnu.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=anT6KKeyjnvnR6YieBbOZmdbe6SldPc3hGDILP2mLtI=; b=XKXAptqLiGt1DgoZW6KAhbHAWK61qdQcJSpDQHhxXdkxmOVMKHydiuEeIOfFZAZ0C/ 1ouxA2rOOZchi1ziI4Q0NHndUe1T2w/7zGTO/9J11nE90EM5C3PWurkeIn4ewQ/5k4oZ EjiOYgnI/Tb0u8rUGMjfOtmTAJU4rK+0M7EVPJQ0hnCL+iECpU6Vcp7viIVOs/yPniRs jd3FhK8QBg4Ox4WHY828p54USjeNJMkJTiAW/Aew/kPm2XeFQB4KlyOqcTLck+n5CieF jG4b6BK5I1+C+wz0A8o8G9fFFEa0E/CBB4KgQFOcBo0JnaJbeiqChKG/szbQxv6pCIWL yt+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719307441; x=1719912241; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=anT6KKeyjnvnR6YieBbOZmdbe6SldPc3hGDILP2mLtI=; b=u+sBJLBPRBegDsjiq3lVJgMuyNh0u21ie5P4e0CkcK0DSu3WFJMmw3zjIVmQXNz/pR SjiYzpU/reLYm45rmoAnR7HFOkxGssmhhNFqcO/fafeGiU6Pn6Oz7zTwlums+Q0z9KQw 01RACJC9m/fKlsZ3ufOXJ3+//xvla6bYkxpooWrMM6RVMdPBZPWnKBpzEfavpnyyNtpE moEPTJd/4NorXywxxHXBcApZ/K79iGWMzJUkTbb95RC0DnMs493ejGTJUgBJGjDxSL91 6LvIOnTbRJVl931hKRMuiCPe8ZAyr6iGACoau0EdZ0tYacN6FqtX/BeBx8y3B3aWAVaD oLUA== X-Forwarded-Encrypted: i=1; AJvYcCX/VyH+jqBBKfFWUn7UU4wxaJDplpjCEjWLpH2aRgTzdAVFtf5b2mG/2pgdidqtySJ0TVyz7PL/gNNyi/BUr49DqxqXde//Yw== X-Gm-Message-State: AOJu0Yy83rWxgMF+FTbI+kJ/bmKj1FRFTm2vPO+uVbwAkL/i4xPxDPsb PDccMbC7grqdqF7aT7jkQ7bwzOjDoLYBd3MKbUomXPJfJcrhj2ROi8whUxytwKw= X-Google-Smtp-Source: AGHT+IFGS10jI2Ma9B01SUUG7ARsnN9EF/n5heLDEv//dv3RllVXtBW+AQCh/BpZXBGwKkHSY4Nonw== X-Received: by 2002:ac2:4a8b:0:b0:52c:dbe7:cfd5 with SMTP id 2adb3069b0e04-52ce064e9b2mr4148542e87.32.1719307440721; Tue, 25 Jun 2024 02:24:00 -0700 (PDT) Received: from euler.schwinge.ddns.net (p200300c8b733b9005e8fc6f38b6af531.dip0.t-ipconnect.de. [2003:c8:b733:b900:5e8f:c6f3:8b6a:f531]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4247d211ae0sm207125125e9.41.2024.06.25.02.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Jun 2024 02:24:00 -0700 (PDT) From: Thomas Schwinge To: Richard Sandiford , gcc-patches@gcc.gnu.org Cc: jlaw@ventanamicro.com, sjames@gcc.gnu.org, seurer@gcc.gnu.org Subject: rs6000: Properly default-disable late-combine passes [PR106594, PR115622, PR115633] (was: [PATCH 6/6] Add a late-combine pass [PR106594]) In-Reply-To: References: <20240620133418.350772-1-richard.sandiford@arm.com> <20240620133418.350772-7-richard.sandiford@arm.com> <87ed8lxun5.fsf@euler.schwinge.ddns.net> User-Agent: Notmuch/0.30+8~g47a4bad (https://notmuchmail.org) Emacs/29.3 (x86_64-pc-linux-gnu) Date: Tue, 25 Jun 2024 11:23:53 +0200 Message-ID: <87frt1l6ja.fsf@euler.schwinge.ddns.net> MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi! On 2024-06-25T10:07:47+0100, Richard Sandiford wrote: > Thomas Schwinge writes: >> On 2024-06-20T14:34:18+0100, Richard Sandiford wrote: >>> This patch adds a combine pass that runs late in the pipeline. >>> [...] >> >> Nice! >> >>> The patch [...] disables the pass by default on i386, rs6000 >>> and xtensa. >> >> Like here: >> >>> --- a/gcc/config/i386/i386-options.cc >>> +++ b/gcc/config/i386/i386-options.cc >>> @@ -1942,6 +1942,10 @@ ix86_override_options_after_change (void) >>> flag_cunroll_grow_size = flag_peel_loops || optimize >= 3; >>> } >>> >>> + /* Late combine tends to undo some of the effects of STV and RPAD, >>> + by combining instructions back to their original form. */ >>> + if (!OPTION_SET_P (flag_late_combine_instructions)) >>> + flag_late_combine_instructions = 0; >>> } >> >> ..., I think also here: >> >>> --- a/gcc/config/rs6000/rs6000.cc >>> +++ b/gcc/config/rs6000/rs6000.cc >>> @@ -4768,6 +4768,14 @@ rs6000_option_override_internal (bool global_init_p) >>> targetm.expand_builtin_va_start = NULL; >>> } >>> >>> + /* One of the late-combine passes runs after register allocation >>> + and can match define_insn_and_splits that were previously used >>> + only before register allocation. Some of those define_insn_and_splits >>> + use gen_reg_rtx unconditionally. Disable late-combine by default >>> + until the define_insn_and_splits are fixed. */ >>> + if (!OPTION_SET_P (flag_late_combine_instructions)) >>> + flag_late_combine_instructions = 0; >>> + >>> rs6000_override_options_after_change (); >> >> ..., this needs to be done in 'rs6000_override_options_after_change' >> instead of 'rs6000_option_override_internal', to address the PRs under >> discussion. I'm testing such a patch. > > Oops! Sorry about that, and thanks for tracking it down. No worries. ;-) OK to push the attached "rs6000: Properly default-disable late-combine passes [PR106594, PR115622, PR115633]"? Grüße Thomas From ccd12107fb06017f878384d2186ed5f01a1dab79 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 25 Jun 2024 10:55:41 +0200 Subject: [PATCH] rs6000: Properly default-disable late-combine passes [PR106594, PR115622, PR115633] ..., so that it also works for '__attribute__ ((optimize("[...]")))' etc. PR target/106594 PR target/115622 PR target/115633 gcc/ * config/rs6000/rs6000.cc (rs6000_option_override_internal): Move default-disable of late-combine passes from here... (rs6000_override_options_after_change): ... to here. --- gcc/config/rs6000/rs6000.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index f39b8909925..713fac75f26 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -3431,6 +3431,14 @@ rs6000_override_options_after_change (void) /* If we are inserting ROP-protect instructions, disable shrink wrap. */ if (rs6000_rop_protect) flag_shrink_wrap = 0; + + /* One of the late-combine passes runs after register allocation + and can match define_insn_and_splits that were previously used + only before register allocation. Some of those define_insn_and_splits + use gen_reg_rtx unconditionally. Disable late-combine by default + until the define_insn_and_splits are fixed. */ + if (!OPTION_SET_P (flag_late_combine_instructions)) + flag_late_combine_instructions = 0; } #ifdef TARGET_USES_LINUX64_OPT @@ -4768,14 +4776,6 @@ rs6000_option_override_internal (bool global_init_p) targetm.expand_builtin_va_start = NULL; } - /* One of the late-combine passes runs after register allocation - and can match define_insn_and_splits that were previously used - only before register allocation. Some of those define_insn_and_splits - use gen_reg_rtx unconditionally. Disable late-combine by default - until the define_insn_and_splits are fixed. */ - if (!OPTION_SET_P (flag_late_combine_instructions)) - flag_late_combine_instructions = 0; - rs6000_override_options_after_change (); /* If not explicitly specified via option, decide whether to generate indexed -- 2.34.1