From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 21160385772A; Wed, 12 Apr 2023 15:10:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21160385772A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681312213; bh=ftM/7+O2hP7YBuu4w1Y1lSKaWy5ug/4TSY04YeRqR/g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ETH2oXuzWsDItRdYFj4yE0hoA+x+D6J4V0CRDfz8flGILeJMSk/NnoPKwgp4GrlP+ ZKYKkjnr2vJs1Sl9k2B8jIFUBqqBtc4Rq41LTJzAXPyzvdt58iYZvtQd93HjEMpd4S BxbS37az8O7oV7kEZuWvOC9O1D1QBVV/COAgSDOU= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109443] missed optimization of std::vector access (Related to issue 35269) Date: Wed, 12 Apr 2023 15:10:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: alias, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109443 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org, | |mpolacek at gcc dot gnu.org --- Comment #7 from Jakub Jelinek --- I think the middle-end could figure this out by itself, such PARM_DECLs or RESULT_DECLs are DECL_BY_REFERENCE and TREE_ADDRESSABLE (TREE_TYPE (TREE_TYPE (parm_or_decl))). I think that means that if one calls a function with two arguments the two arguments won't alias: struct S { S (); ~S (); S (const S &); int s; }; void foo (S a, S b) { } void bar (S c) { foo (c, c); } Inside of the function one can take address of such a parameter as many tim= es as one wants and dereference through that of course. But I think one can assume that when the function is called, the argument (i.e. the address of the object in the cal= ler) isn't stored anywhere else.=