From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by sourceware.org (Postfix) with ESMTPS id 0763C3858D33 for ; Mon, 11 Dec 2023 07:27:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0763C3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0763C3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702279676; cv=none; b=wzz5Pi/li7pdZ5cMkGCtedcbxHR4GLpJejLm0XNsY/WBoXi06fg78drv4w42sk+9w0ggFxMq/O47MLyg+rdvA7KKBXHl63YjBxJnrKQXAoMSDIiGdwSQLOvAxwgRBPLvzIV5Qa61ocfCEllhpIEhYqsxGsA8PMZuayEDsmhREN4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702279676; c=relaxed/simple; bh=5cof274y9C7BQBXjVN1hqN7ewRKFalkFDko/J5SA/9o=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=GVPNo4yGMg8uQsKXAQxIdOmxtNUGUOnsRlrLXS8gWtJUNwZw4CbCuLUKiQMNr8q1Cw+/NYWswas8LcRew1cWCGwofPk34HB675hG8qmVIGOLG6czJuvjHQ5xo/hvwR/6ZPPQFFurL9vpxifn97mP7F738GC1Ov5GrIITyi0fYSI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-50c0f13ea11so4589773e87.3 for ; Sun, 10 Dec 2023 23:27:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702279673; x=1702884473; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=uY2efksvTQQfgEkagGdRSa1HuR5JuVS002WLIBijX68=; b=Rb/sTByg0LD8f2nq7zLevSWb0w2u9XqG7F9l57lZcSTezxSwcquessGEis7c2vOxvQ 653WRuVpH8GhrHLo0Q6TPLq3Lh8DOfTFRkKEyU6yMs2wjNNbG+Z4yaSOK/Ey57ZsTMuC 5I6FVh3JgK+xEruEbfuSy7T2hDU6EcoouQcynv2Ol7fc6LMjsdBlty4eBKMZlIFBHbp/ cPZFOBd9nZx8jDFyZv3KkPCM1xymD7qV3oDkTgmSKeDG1lIo7gyavkR3+g8+XHJ4AnAF 7DlEGXRFEkc2pcirzZL7aiE+C+VmvwO1vLp3XwV2/0TqAqUsLwGJoaMHt11KjZH8xycu dJFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702279673; x=1702884473; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uY2efksvTQQfgEkagGdRSa1HuR5JuVS002WLIBijX68=; b=hGw2sQjf36sxxOQ67n4+AO6Yv6N2QWAVkozeBZx2bjL0kE99kDw8jm/KuWOYSomdb9 OHqd3zE2akiuoKsH2DEARH/gYwrqU+xtec5NZKRvVDlDOFM53u8I6AdRgFC2FYR01/Z6 Bhqssn+yinBRoK0+O55c6mbM8X1D13oMUrv1LiCY4TFZNyItn/KJJyRRAeDL/DYVrYit oMbyg1qucGIv4YmDPBwm+KE4IJYC94CQ46i2n37eCIKLuE2vmqvQe0D9+sE7mLUHqAbj imd54hR+jdVMvLqp93XMW9joHKr+wG/cevaIvW9dV1EWSA+fFV4+jys8lO6/FWeXOAzX I4VQ== X-Gm-Message-State: AOJu0Yzgua3MoBzH27UKlZRU1DbEORjvsamZAa9g+wLlGQhAKzJeCA23 DbvXZw3JXYCZBrZ6jwJDYy8CSDYCg45UaM1yaus= X-Google-Smtp-Source: AGHT+IEbrzIzpVKKZkzkODUgCiJcbVdKL4Dg+g0fitM7Q5IuTCUToCMDIuR8yORBAhV64Up0gnxLmKQQ0xHb33hnT5U= X-Received: by 2002:a05:6512:12ca:b0:50c:2168:7c60 with SMTP id p10-20020a05651212ca00b0050c21687c60mr1805726lfg.14.1702279673061; Sun, 10 Dec 2023 23:27:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Richard Biener Date: Mon, 11 Dec 2023 08:26:40 +0100 Message-ID: Subject: Re: [PATCH] strub: add note on attribute access To: Alexandre Oliva Cc: Jan Hubicka , gcc-patches@gcc.gnu.org, Jeremy Bennett , Craig Blackmore , Graham Markall , Martin Jambor , Jim Wilson , Jeff Law , Jakub Jelinek Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,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 List-Id: On Sat, Dec 9, 2023 at 3:09=E2=80=AFAM Alexandre Oliva = wrote: > > On Dec 7, 2023, Alexandre Oliva wrote: > > > Thanks for raising the issue. Maybe there should be at least a comment > > there, and perhaps some asserts to check that pointer and reference > > types don't make to indirect_parms. > > Document why attribute access doesn't need the same treatment as fn > spec, and check that the assumption behind it holds. > > Regstrapped on x86_64-linux-gnu. Ok to install? OK > > for gcc/ChangeLog > > * ipa-strub.cc (pass_ipa_strub::execute): Check that we don't > add indirection to pointer parameters, and document attribute > access non-interactions. > --- > gcc/ipa-strub.cc | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc > index 2afb7a455751d..8ec6824e8a802 100644 > --- a/gcc/ipa-strub.cc > +++ b/gcc/ipa-strub.cc > @@ -2889,6 +2889,13 @@ pass_ipa_strub::execute (function *) > && (tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (nparm))) > <=3D 4 * UNITS_PER_WORD)))) > { > + /* No point in indirecting pointer types. Presumably they > + won't ever pass the size-based test above, but check the > + assumption here, because getting this wrong would mess > + with attribute access and possibly others. We deal with > + fn spec below. */ > + gcc_checking_assert (!POINTER_TYPE_P (TREE_TYPE (nparm))); > + > indirect_nparms.add (nparm); > > /* ??? Is there any case in which it is not safe to suggest the= parms > @@ -2976,7 +2983,9 @@ pass_ipa_strub::execute (function *) > } > } > > - /* ??? Maybe we could adjust it instead. */ > + /* ??? Maybe we could adjust it instead. Note we don't need > + to mess with attribute access: pointer-typed parameters are > + not modified, so they can remain unchanged. */ > if (drop_fnspec) > remove_named_attribute_unsharing ("fn spec", > &TYPE_ATTRIBUTES (nftype)); > > > -- > Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ > Free Software Activist GNU Toolchain Engineer > More tolerance and less prejudice are key for inclusion and diversity > Excluding neuro-others for not behaving ""normal"" is *not* inclusive