From patchwork Thu Jan 18 23:27:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 1888280 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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 4TGJnz71m1z1yPJ for ; Fri, 19 Jan 2024 10:28:05 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 71F573858C42 for ; Thu, 18 Jan 2024 23:28:02 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id ADF183858D33 for ; Thu, 18 Jan 2024 23:27:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ADF183858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org ADF183858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.141.98 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705620461; cv=none; b=eOxzZrYrxWyeo3bsgm35NcOIp+kuWREje7QusXkuj7tUwBNPw03wggvIVXAINI8VOx3UlGkfuiaX/HrhTk9nQz2TjDfTvoSnjMqi8cGQ4qaUhJK9H3TRndxp9huBzHXEk3zpVXtD4w9n9q+atVEmB01jTAEL1B3qnQLMMpORDA4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705620461; c=relaxed/simple; bh=Iapti28baGfSEVmT2wdeQRPz060q2ap4/11MEb3cBEg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=v5q3h3aIQcfIDKTIgL8kSTOKAlW2J8lMMFDw/nM+aSHVpfg0ixPAcLQQReOuHe5GK3daYOfMmJDs9bKS4Q+3Fk+10IgiQa7Bmsf6qmbM1ByIRzmgjCmS9T4L2mCeXssDQNGz8OqBZAcekuqvhUqv5QN4tVwJFgwdw08VNp6cOvM= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: Y/o1hMOtQja2qR2seSIFPA== X-CSE-MsgGUID: PdeHwUQpQoqc/JMwoApOqg== X-IronPort-AV: E=Sophos;i="6.05,203,1701158400"; d="scan'208";a="31635095" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 18 Jan 2024 15:27:37 -0800 IronPort-SDR: TsVaZKwH46t0BbH9lknq2vlTbrA7KPhvKJ4h3AIkIzhNqqy12jdU/7I++tp5Gx5+Nzzx4BBSms G9v6YPmgPVKrRyoA71MT9giA19jkgp1NE8IbACmsHrf6rlGDRigoOvQ6AxEUcd/Akj9O6HR764 qvn6ReOLAC9M9okpTfnt2xyerXRrT4p1i1F8lBGdt0bCrfT5S14uTTGVETrowednH0F9zNM0gQ X+4q4podxYxFSJO85y2xn42qUaG9CmAAjXHrVakhL1SwXo3zwBoPYMlNGtDFLiZ5cFnX3TTODp eCE= From: Sandra Loosemore To: Subject: [COMMITTED] Improve documentation of noinline and noipa attributes [PR108470] Date: Thu, 18 Jan 2024 16:27:20 -0700 Message-ID: <20240118232721.2659937-1-sandra@codesourcery.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-ClientProxiedBy: svr-orw-mbx-15.mgc.mentorg.com (147.34.90.215) To svr-orw-mbx-13.mgc.mentorg.com (147.34.90.213) X-Spam-Status: No, score=-10.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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 gcc/ChangeLog PR ipa/108470 * doc/extend.texi (Common Function Attributes): Document that noinline also disables some interprocedural optimizations and improve flow to the part about using inline asm instead to disable calls from being optimized away completely. Remove the sentence that says noipa is mainly for internal compiler testing. --- gcc/doc/extend.texi | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index d879ad544b5..616e26d47dc 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -3666,13 +3666,17 @@ propagation. @cindex @code{noinline} function attribute @item noinline This function attribute prevents a function from being considered for -inlining. +inlining. It also disables some other interprocedural optimizations; it's +preferable to use the more comprehensive @code{noipa} attribute instead +if that is your goal. + @c Don't enumerate the optimizations by name here; we try to be @c future-compatible with this mechanism. -If the function does not have side effects, there are optimizations -other than inlining that cause function calls to be optimized away, -although the function call is live. To keep such calls from being -optimized away, put +Even if a function is declared with the @code{noinline} attribute, +there are optimizations other than inlining that can cause calls to be +optimized away if it does not have side effects, although the function +call is live. To keep such calls from being optimized away, put + @smallexample asm (""); @end smallexample @@ -3691,8 +3695,7 @@ the body. This attribute implies @code{noinline}, @code{noclone} and to a combination of other attributes, because its purpose is to suppress existing and future optimizations employing interprocedural analysis, including those that do not have an attribute suitable for disabling -them individually. This attribute is supported mainly for the purpose -of testing the compiler. +them individually. @cindex @code{nonnull} function attribute @cindex functions with non-null pointer arguments