From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B11E53858D20; Tue, 11 Apr 2023 13:28:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B11E53858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681219733; bh=aD/CsTZ+a5MgylzWvj5jW8cqYfnFdKqknIV6bM5djH4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dnLe9iwN67qanYCoontZ/UoLlQR+AUnfE64wqnYyR+rUSrnGUM8Vn67gkt/lXjuz4 LDuO2XnQYREIasjXAH3qM3TPbH+K4rE2bwEj/RGY7hn9aOh5quk6rK3hlS2TTAtb2P 3wINNER7Sfjx3EzT1P7gFYHlbBy52dBosBDP54cY= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109442] Dead local copy of std::vector not removed from function Date: Tue, 11 Apr 2023 13:28:53 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal 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: keywords bug_status everconfirmed cc cf_reconfirmed_on version 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=3D109442 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|UNCONFIRMED |NEW Ever confirmed|0 |1 CC| |jwakely.gcc at gmail dot c= om, | |rguenth at gcc dot gnu.org Last reconfirmed| |2023-04-11 Version|unknown |13.0 --- Comment #1 from Richard Biener --- So we're failing to DSE _13 =3D pretmp_25 - pretmp_63; if (_13 > 4) goto ; [97.30%] else goto ; [2.70%] [local count: 14278734]: if (_13 =3D=3D 4) goto ; [34.00%] else goto ; [66.00%] [local count: 913536322]: _23 =3D (long unsigned int) _13; __builtin_memmove (_37, pretmp_63, _23); goto ; [100.00%] [local count: 34511373]: _24 =3D *pretmp_63; *_37 =3D _24; [local count: 542742079]: operator delete (_37, _49); because I think the DTOR / overloaded global delete might inspect the vector contents. So I'm not sure it would be valid to elide the memmove/store. When the stores would be elided we'd DCE the new/delete pair as well.=