From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 39C1E3858C20; Sat, 14 Oct 2023 15:36:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 39C1E3858C20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1697297816; bh=PQQjnBKykstSKQsAHrLz0p1SZOg4uj72DsPhNtrtZHA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pkMCmc4Zu6y0bC53ITX0pkyjDnBQehYnizQ4aWZhtqmRa6970pVH2zBgG3baGyDZS u/H184iDCHICHnA/3PSqFkXczy5zrjw5VubPu8LUE4pvEkd4wHmIoB4Y+AnoQ+CHzY HRr2bRoSINjhaGcixv0igPTV3P4bHPUOFoHxshV8= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111805] suboptimal codegen of variant Date: Sat, 14 Oct 2023 15:36:55 +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: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: everconfirmed keywords bug_status cf_reconfirmed_on component 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=3D111805 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Keywords| |missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed| |2023-10-14 Component|c++ |middle-end --- Comment #2 from Andrew Pinski --- Anyways we have: __builtin_memcpy (&v.D.38438._M_local_buf, "abc", 3); _5 =3D &MEM[(struct basic_string *)_3(D)].D.38438._M_local_buf; MEM[(struct _Alloc_hider *)_3(D)]._M_p =3D _5; __builtin_memcpy (_5, &v.D.38438._M_local_buf, 3); MEM[(struct basic_string *)_3(D)]._M_string_length =3D 3; MEM[(char_type &)_3(D) + 19] =3D 0; If we able to remove the first memcpy things would be just work I think ...=