From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 36FE63856609; Mon, 5 Jun 2023 07:16:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 36FE63856609 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685949407; bh=Z0PSQNToIZ3S2zB+utPhlz8oTi1pZBm8L7Dk4/m1meI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=G8yFuQHICvfqvJgPp18UlkGWjILkYFN8njxN/OinnxO1G3G/vbdP/mAKCekReSlQg Og9mG5EaMVNQHihk+RDcuWiKhkMIqRcAI5PhW8qTsNJOItS9fBcxrjJ/3qe5c5u19/ RD2P3gjL1HyRHvL3MaORS4QZ0aCBmPtiKUuRJ41A= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110035] Missed optimization for dependent assignment statements Date: Mon, 05 Jun 2023 07:16:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.1.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: rguenth 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: 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=3D110035 --- Comment #8 from Richard Biener --- (In reply to Pontakorn Prasertsuk from comment #7) > For the LLVM IR code of the snippet I provided, Clang's alias analysis can > prove that `new` call has no side effect to other memory location. This is > indicated by `noalias` keyword at the return value of the `new` call (_Zn= wm). >=20 > According to Clang's Language Reference: > "On function return values, the noalias attribute indicates that the > function acts like a system memory allocation function, returning a point= er > to allocated storage disjoint from the storage for any other object > accessible to the caller." >=20 > Is this possible for GCC alias analysis pass? > MyClass c =3D a; > MyClass *b =3D new MyClass; > *b =3D c; the point is that 'new' can alter the value of 'a', GCC already knows that 'b' is distinct from c and a but that's not the relevant thing. It looks like LLVM creates wrong-code here.=