From patchwork Thu Jul 11 13:07:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1959330 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; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=ELdLpapc; 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 4WKZm12sxJz1xqr for ; Thu, 11 Jul 2024 23:08:17 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 849A83870C3D for ; Thu, 11 Jul 2024 13:08:15 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id B51F2384A050 for ; Thu, 11 Jul 2024 13:07:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B51F2384A050 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B51F2384A050 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720703278; cv=none; b=Ezvgxn1G+VQhZDIO9KF7+/wJO+E9EncxB+ReDv5DLcO5XwX8novEeEtAiiolEd1c8ffUMG/bJVcGjtc5KOWKWrhv9FeCxYj5NZB18KDhvJGtiUWt71L57H2sXvOZuIFghesCf4SSRV82r7IpNNpoh7l0tYxBbAvzYYea8SkruRI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1720703278; c=relaxed/simple; bh=FiAZWy1IB/8oK6hLnRZM6rzNu+klw8oVdYcusZZ/mtQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=xKYA/O1EX4/AJZwNlnovkX1WJEnkpFSkW20qGt4rgKJDtL/tO1JxMlGjc8lJuiPDgU4xAFNEhAvPRqytgsTdIE+lhVjfFDpfKbrh+qI9MB8mdzKf2cW9ITelA0jnzrL3215be30kfJQiQUWIrRJJXayLrJskxSjxuqHy0QqjF5w= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-70af4868d3dso749564b3a.3 for ; Thu, 11 Jul 2024 06:07:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1720703276; x=1721308076; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=HadQbLyH/POKLwrZ2V5fCPBIOv/bvOf9u219v11hZZc=; b=ELdLpapcYWT8l4PzN/ODAJkuJ0IfjPN+jSaq5QJtyqcg+c4Woer69dJEdPw0GDQRpc VpMLTJtJA47pRyHXxtuwRIyVmuST2PKO5A8pCHSSXkY6NfoX/UqWDCULZPUKBiF8+dyB 7V63CZqfrThP7L3UiHwFGOczUmUxZqVyCcgl0oIp+aCGhsJkW/eEsXs1/w4ZneTMhEJz rrrX+e1U5IcaMpUptPcqwqlvBHlkruhrC86x4WICRHvh5PaaX12Z94sDPtHcJZ+ax0SQ 9Blulj1DIWUQ5sy8DHk3XE37MtJd5Ziq5oVz/XXVTBNEXV3Vc5LU6v316UDLrR9wELx6 V8OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720703276; x=1721308076; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HadQbLyH/POKLwrZ2V5fCPBIOv/bvOf9u219v11hZZc=; b=Lfl13HmG2s9Sw14aRtf4pmz542renAOlafCfTWu/60oFS4iEi9CkTchMj4DJ+ZVthR sDtC0Z5gmr7rj2pzrY0S7Xv0l42E3p6UZYT0Mr+BO78HcJ1xISAoM/zWI9dnyKjEPzCC 145OmqDh5MQNChFIxJXW28ScxNsa9GD4HMeMA1UEO2As9aJXbmgLwDzHZfX5LTNtozO7 t6+cedeTaw/Bc/s1PF685tTWc5DjPF8HBWxiFNuTmqQiKpJaRYY43fbmFX6gVT1jgbrc 230aYpoDb/++vxfYhS4hChswahbWealTlsSNC1bF1zs0zBYRfI0+7VTSz+GXQ7md8Gh2 n6Mw== X-Forwarded-Encrypted: i=1; AJvYcCUFDTWu8MCJ+aiFN6bhPp6k4WLsJ/G3Q/moVEtCa/O5dWPop12GgJBMVoK2yqI5c7H3YOfGX6ujE/txrKsGIl0xIiCXivtpuw== X-Gm-Message-State: AOJu0YyQZU5BldgXp89VuZLipdKhhyObWLMkmWx8ZERSBvR5lYT9m49x oUDb9r924FEFE7+kIQ0IwDUhmWIkUzPE+NPwtAoyp5hJE/3qmvF0idSAXfiLyQ== X-Google-Smtp-Source: AGHT+IEIqWDIQ/QLEqvaHmLRbXvTv06UdJGhI5S+nxvcO/NHXg5Mu5GDbFnh+qdTkOA/twUBelTptA== X-Received: by 2002:a05:6a20:6a0e:b0:1c0:ed64:e4a9 with SMTP id adf61e73a8af0-1c29824f039mr9653429637.34.1720703275567; Thu, 11 Jul 2024 06:07:55 -0700 (PDT) Received: from free.home ([2804:7f1:218a:d53f:1f12:68c4:3c4:d64a]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70b43898b03sm5612856b3a.8.2024.07.11.06.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 06:07:55 -0700 (PDT) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 46BD7exV1013005 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 11 Jul 2024 10:07:40 -0300 From: Alexandre Oliva To: Rainer Orth Cc: Hongtao Liu , gcc-patches@gcc.gnu.org, Hongyu Wang , Jan Hubicka , Uros Bizjak Subject: [i386] adjust flag_omit_frame_pointer in a single function [PR113719] (was: Re: [PATCH] [i386] restore recompute to override opts after change [PR113719]) Organization: Free thinker, does not speak for AdaCore References: Date: Thu, 11 Jul 2024 10:07:40 -0300 In-Reply-To: (Alexandre Oliva's message of "Thu, 04 Jul 2024 22:35:21 -0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, WEIRD_QUOTING 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 On Jul 4, 2024, Alexandre Oliva wrote: > On Jul 3, 2024, Rainer Orth wrote: > Hmm, I wonder if leaf frame pointer has to do with that. It did, in a way. ---- The first two patches for PR113719 have each regressed gcc.dg/ipa/iinline-attr.c on a different target. The reason for this instability is that there are competing flag_omit_frame_pointer overriders on x86: - ix86_recompute_optlev_based_flags computes and sets a -f[no-]omit-frame-pointer default depending on USE_IX86_FRAME_POINTER and, in 32-bit mode, optimize_size - ix86_option_override_internal enables flag_omit_frame_pointer for -momit-leaf-frame-pointer to take effect ix86_option_override[_internal] calls ix86_recompute_optlev_based_flags before setting flag_omit_frame_pointer. It is called during global process_options. But ix86_recompute_optlev_based_flags is also called by parse_optimize_options, during attribute processing, and at that point, ix86_option_override is not called, so the final overrider for global options is not applied to the optimize attributes. If they differ, the testcase fails. In order to fix this, we need to process all overriders of this option whenever we process any of them. Since this setting is affected by optimization options, it makes sense to compute it in parse_optimize_options, rather than in process_options. Regstrapped on x86_64-linux-gnu. Also verified that the regression is cured with a i686-solaris cross compiler. Ok to install? for gcc/ChangeLog PR target/113719 * config/i386/i386-options.cc (ix86_option_override_internal): Move flag_omit_frame_pointer final overrider... (ix86_recompute_optlev_based_flags): ... here. --- gcc/config/i386/i386-options.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index 5824c0cb072eb..059ef3ae6ad44 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -1911,6 +1911,12 @@ ix86_recompute_optlev_based_flags (struct gcc_options *opts, opts->x_flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN; } } + + /* Keep nonleaf frame pointers. */ + if (opts->x_flag_omit_frame_pointer) + opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER; + else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags)) + opts->x_flag_omit_frame_pointer = 1; } /* Implement part of TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook. */ @@ -2590,12 +2596,6 @@ ix86_option_override_internal (bool main_args_p, opts->x_target_flags |= MASK_NO_RED_ZONE; } - /* Keep nonleaf frame pointers. */ - if (opts->x_flag_omit_frame_pointer) - opts->x_target_flags &= ~MASK_OMIT_LEAF_FRAME_POINTER; - else if (TARGET_OMIT_LEAF_FRAME_POINTER_P (opts->x_target_flags)) - opts->x_flag_omit_frame_pointer = 1; - /* If we're doing fast math, we don't care about comparison order wrt NaNs. This lets us use a shorter comparison sequence. */ if (opts->x_flag_finite_math_only)