From patchwork Thu Dec 14 19:54:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 1876377 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=hDqmoyvr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; 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 [8.43.85.97]) (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 4Srjjg2hxVz23nF for ; Fri, 15 Dec 2023 06:54:31 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 60358385E038 for ; Thu, 14 Dec 2023 19:54:29 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id D62373858C2C for ; Thu, 14 Dec 2023 19:54:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D62373858C2C Authentication-Results: sourceware.org; dmarc=pass (p=none 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 D62373858C2C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::529 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702583659; cv=none; b=xSOrfkyqvJuI3NQFn9w90zJIBEJ78d7xbCX/eOloVNbE272NS0XkVynd6w4pD1c6ztvoHcN5TFsz5P4tfRhE/I27wJOGOYDOPMY2H0tleFydI6wIpraJnkg+23FQb3jQaX/vDqCMb3JuE0eOTOBSF01I5UT+wPem7LhsxKwD+wk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702583659; c=relaxed/simple; bh=hpT622C+OqEWxR8dptEkx0WAOmAxNDZdeJ41EGMsliY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=I2R102dPDduKx7DhVtRa7zTGEaePOBAP0KoFwaiAjYR0XSqGnVHLHFSHQIDFFuG2ZhL5/Vz0r75DJGOVNG1UQhfPQ7cJgLxMvpPX7/XiGZFWaLkmkaX7TPU19sELajfpnenmTBhHfvAH6xCzyEAZR4kn5tCSzkaM9kugb8L/jkM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5c69ecda229so4796647a12.2 for ; Thu, 14 Dec 2023 11:54:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1702583657; x=1703188457; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=xQ+tGvuitghOQPJwPlVFbzrPsXVVTZIkLcUlQGwYvWc=; b=hDqmoyvrwLB0l2VFkEexptxdcVZehJ7HR9h64seaki6a6q2t0tB9Y5VwlJiF569rIw fpgGlWnmkSLr8d5l8IhNXCgMZG0jipF+s0YGoiWSx5waqfF/9kbDqVCtDLf2QkbOQh7G X3HqlSugsK4Ra9VvQ+XjoqQy4k5siqmsF7vyJnykyUPEgKzQPITVs/5DsjbtMmH9hpsx Vj3kFahnsFnO/4pr6HpHg9SKhmY+s0YMK0JTUX5A8nsdpVfRPV7tZgYpDG24O8blZDih 6zFyd2RM87vqaf7os32KspexD8C0jthxMGBqw6POMn8zozptZHwUj9wWqztWjldCouLh FVVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702583657; x=1703188457; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xQ+tGvuitghOQPJwPlVFbzrPsXVVTZIkLcUlQGwYvWc=; b=m6R/L5XMOauuCFgEciFkALmuyjEoaT/epE4VBVY6uuehR4+Cz2oYGFvfvtiooqpy2L rB7QzZtQLsiFxW8nCXZntDgTWInw0uNK7oAQMZJZ06Yk1IIZbXnLChAM7UdXt+mmVTZN Q7Dk5NzDgmLIFNIhZT4eCqz2kS8IeJE/LlC+mHDs3h3HuxY2FRj1Qc+S4Uc2jdjmY07T SIJs3+I3iZHr2Mv+HbyIRpD12ZZL/kaDk/EBQqA186xPJ53Ed8RKF45AwgTQ3dlHIxOL XtRnqkmP7wL7qmi52Am3T4CUCUcJ6X9UN9oRHi5c5GpVPk9mWoOWWg7bn7PvdZ6hsz8G zaNw== X-Gm-Message-State: AOJu0YyL65FcQVnSjDSDra0eUWlPsM8CQxZQX7D4QN9a/vtO53jooXF5 0ol6vKcorgPM3abZPsAmpuAZ+s8KvIKrIxP5SySOrQ== X-Google-Smtp-Source: AGHT+IHO6MEPXNfcJHoCh04gSvUS3LK+qdChjTGABX1ACkGMzkQd8hsUBB/ho+gkWl70gMywQhDBNQ== X-Received: by 2002:a05:6a20:144c:b0:181:bc16:48dd with SMTP id a12-20020a056a20144c00b00181bc1648ddmr6786749pzi.47.1702583656819; Thu, 14 Dec 2023 11:54:16 -0800 (PST) Received: from free.home ([2804:7f1:2080:cecc:5977:530e:86b5:e7be]) by smtp.gmail.com with ESMTPSA id r1-20020a62e401000000b006ce91d27c72sm12597422pfh.175.2023.12.14.11.54.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 11:54:16 -0800 (PST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 3BEJs8OF488980 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 16:54:08 -0300 From: Alexandre Oliva To: gcc-patches@gcc.gnu.org Cc: Richard Biener Subject: [PATCH] strub: use opt_for_fn during ipa Organization: Free thinker, does not speak for AdaCore Date: Thu, 14 Dec 2023 16:54:08 -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=-12.4 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, T_SCC_BODY_TEXT_LINE, 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 Instead of global optimization levels and flags, check per-function ones. Regstrapped on x86_64-linux-gnu, also testing on sparc-solaris2.11.3. Ok to install? (sorry, Richi, I dropped the ball and failed to fix this before the monster commit) for gcc/ChangeLog * ipa-strub.cc (gsi_insert_finally_seq_after_call): Likewise. (pass_ipa_strub::adjust_at_calls_call): Likewise. --- gcc/ipa-strub.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc index 943bb60996fc1..32e2869cf7840 100644 --- a/gcc/ipa-strub.cc +++ b/gcc/ipa-strub.cc @@ -2132,7 +2132,7 @@ gsi_insert_finally_seq_after_call (gimple_stmt_iterator gsi, gimple_seq seq) || (call && gimple_call_nothrow_p (call)) || (eh_lp <= 0 && (TREE_NOTHROW (cfun->decl) - || !flag_exceptions))); + || !opt_for_fn (cfun->decl, flag_exceptions)))); if (noreturn_p && nothrow_p) return; @@ -2470,9 +2470,11 @@ pass_ipa_strub::adjust_at_calls_call (cgraph_edge *e, int named_args, /* If we're already within a strub context, pass on the incoming watermark pointer, and omit the enter and leave calls around the modified call, as an optimization, or as a means to satisfy a tail-call requirement. */ - tree swmp = ((optimize_size || optimize > 2 + tree swmp = ((opt_for_fn (e->caller->decl, optimize_size) + || opt_for_fn (e->caller->decl, optimize) > 2 || gimple_call_must_tail_p (ocall) - || (optimize == 2 && gimple_call_tail_p (ocall))) + || (opt_for_fn (e->caller->decl, optimize) == 2 + && gimple_call_tail_p (ocall))) ? strub_watermark_parm (e->caller->decl) : NULL_TREE); bool omit_own_watermark = swmp;