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: 189360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp684650dyb; Thu, 18 Jan 2024 15:28:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJd+mky54zVpx2KxQAPHsVnacU13oqVbi/2GgujjeVUIlGiUKlr0Ujed3PBJwc55t0EvOm X-Received: by 2002:a05:620a:2808:b0:77f:700a:e46f with SMTP id f8-20020a05620a280800b0077f700ae46fmr500421qkp.85.1705620510704; Thu, 18 Jan 2024 15:28:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705620510; cv=pass; d=google.com; s=arc-20160816; b=Rxi2wFbp8yx2CP+YQ814OR/vkXWFSJgHJir6p9XaxjJLzDsf8r6i4ZuqRPJgjWwPy9 a3QvQQXDmbjWEp2KUEEv4zTE8rm+9XshEwAR+U0IOqnylDOB0FkyjMmewSsNP3/RdpVb 9BHdLs146Zva93hHF7e+uzoU8Bl9q66+EjEgvvihXO8CJp0kAgLuqr4F+JuHi69t9g11 Mg/J+0oPsp80DAAp8AaBPcO3QYoUilcRrualiP2AyioVNxh0zClW7BdGRczT9eNZ+TBG 0ICZmdTXzRSLjXmVsOFxNH2mSKuDukZa3vDB6c7wGFKZCMFvBPifPR1CTVVsVsgtfG6N mneg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:ironport-sdr :arc-filter:dmarc-filter:delivered-to; bh=cbmgI7kbQ7TAn9bpQ4JaA+KYRM4sk8NcdE9D/GD7Gsg=; fh=gk9A5O7Gbglvz1MjrRQ4hZ2i3c68kYkpOZJg1emXh+g=; b=yk16ChclXYArYsw+DobVpStMMzgtyoHjxzoDGhbXnsieh4/4/KcC9uwkHQSSC3h9S3 amq0mEyqAXmtE30VeEq/r4FjpO+x3StaGTB5pnBPDvZPepPJho8Dt6btzKI0yuuNWFDt 7ToUAnLFPkrirUiDz8s5j4VfjmUoQS/1PqwDDOoI/VjZg2O+g2giVYJnLGuYpNh0wo3V teBJpgGGf9e1j48XJgv9b+HLZes9ytPHcLcRrIdv77kZGOseR2vCL4kNi2q1kyqLNpC5 3lFKoGCJIHEpWiy3fxPHt9MLsiCppi6BBGKlHfJCk6+M3sjVMUz/qMGx6sXMkpXxlu+a mp3A== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id x6-20020ae9e646000000b007725a68ea34si14566910qkl.89.2024.01.18.15.28.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 15:28:30 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E6E4A3858D33 for ; Thu, 18 Jan 2024 23:28:29 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788472732165732121 X-GMAIL-MSGID: 1788472732165732121 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