From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 545A93858C52; Wed, 22 Nov 2023 14:29:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 545A93858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700663399; bh=33E+qon5+WB8Z4k9QxmZKiIT9hO+7xk2TCc5xRbJSCM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=h3DFrKPEZz3/kB42BjEB4qncMws/CJ20Ll94XQ/CxkRfCZ+KewLFEmoYA9oJ3VzQT v+hf3VwUAPqI4oABDwdVNkFRBKXh1tKKC2agH7JjjdLlUjRLXlvJHAwV/lvkehKOQb +oLpQBO0HcDzpggeg2NNzRRszhET0jiROUk3j5Bg= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/112653] We should optimize memmove to memcpy using alias oracle Date: Wed, 22 Nov 2023 14:29:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: unknown X-Bugzilla-Keywords: alias, 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=3D112653 --- Comment #6 from Richard Biener --- (In reply to Jan Hubicka from comment #5) > > but the issue is that test2 escapes which makes this conflict: >=20 > It is passed to memmove which is noescape and returned. Why local PTA > considers returned values to escape? The pointed to memory escapes which means that stores to it are not dead. Mind we do not have a separate points-to set for escaped via return (some functions can also "return" like via EH or longjmp, and we can't really know the latter w/o IPA analysis). Pointers can also escape to global memory. Special-casing the regular return path is sth that's possible (also IPA points-to doesn't compute a "local" escaped at all but preserves the non-IPA solution for that), but in the end it didn't seem important enough for me to try doing that ... We have the function entry state which is NONLOAL, ESCAPED is what determines "global memory" for all sorts of optimizations. If we split out RETURN_ESCAPED then that would be ESCAPED | RETURN_ESCAPED and alias disambiguation could avoid RETURN_ESCAPED. But ESCAPED handling is complicated already ...=