From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BB09E3858423; Wed, 22 Nov 2023 15:06:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB09E3858423 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700665562; bh=WayVrEL71zfXFzYb+avCTwRPkjisKPq/eC+LLxmGElw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MENMpUwSA+AG15ElpRiCDgrPvWb1ccP3fm4i9QTRhHk29+xbsiknZNoQuKX5E1igu 6YdG/G2cY1KFkgSl3OpcH4GlO+yZmv1zOAm7mLovZ7VXNYRrHnFcUEWObwHKMoc7Ls Fr5iwFMjguwC/2y52lImCzHJHUGYcQrzzW1DTVog= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/32667] block copy with exact overlap is expanded as memcpy Date: Wed, 22 Nov 2023 15:06:02 +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: 4.2.0 X-Bugzilla-Keywords: wrong-code 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: 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=3D32667 --- Comment #27 from Jakub Jelinek --- (In reply to Rich Felker from comment #26) > > The only reasonable fix on the compiler side is to never emit memcpy bu= t always use memmove. >=20 > No, it can literally just emit (equivalent at whatever intermediate form = of): >=20 > cmp src,dst > je 1f > call memcpy > 1: >=20 > in place of memcpy. No, that is not a reasonable fix, because it severely pessimizes common code for a theoretical only problem.=