From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BEDAE394848D; Sun, 29 Mar 2020 19:20:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEDAE394848D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585509658; bh=RcEHzLpb7cA463sk6nwej+rbfUQYpuZlCN3b3UMmCTM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=noLyxhySTzT5+oTa0WvFWJun0rZR472WkA35BsxyVsd+vdoBDC0//xbIRdLca1WHH RcpRRQRyuODtqQdNhxC7oP+z3N5jSpdANkUbaofgkx+EjDKCMIurgCehcMMb4tfNzJ 1cdyCcL3fW9j+sTRan4mqGniAPgnLzHkm/MbFarE= From: "glisse at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/51965] Redundant move constructions in heap algorithms Date: Sun, 29 Mar 2020 19:20:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.7.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: glisse 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Mar 2020 19:20:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D51965 --- Comment #19 from Marc Glisse --- (In reply to Jonathan Wakely from comment #16) > (In reply to Marc Glisse from comment #5) > > (The split into push_heap and __push_heap is just so the first part can= be > > inlined without the second, right?) > >=20 > > A more direct adaptation of the old code to rvalue references would be: > >=20 > > std::__push_heap(__first, _DistanceType((__last - __first) - 1), > > _DistanceType(0), _ValueType(_GLIBCXX_MOVE(*(__l= ast - > > 1)))); >=20 > I tried doing this and it didn't seem to help the testcase attached here. push_heap(): default_ctors=3D0, copy_ctors=3D0, copy_assignments=3D0, swaps= =3D0, [-cheap_dtors=3D1998,-] {+cheap_dtors=3D999,+} expensive_dtors=3D0, [-move_ctors=3D1998,-] {+move_ctors=3D999,+} cheap_move_assignments=3D2201, expensive_move_assignments=3D0, comparisons=3D2196 It doesn't help the other operations, but it has some effect on this one.=