From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28039 invoked by alias); 23 Jan 2012 14:05:53 -0000 Received: (qmail 28028 invoked by uid 22791); 23 Jan 2012 14:05:52 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_SV X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Jan 2012 14:05:39 +0000 From: "chris at bubblescope dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/51965] Redundant move constructions in heap algorithms Date: Mon, 23 Jan 2012 14:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: chris at bubblescope dot net X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-01/txt/msg02639.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51965 Chris Jefferson changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris at bubblescope dot | |net --- Comment #2 from Chris Jefferson 2012-01-23 14:04:43 UTC --- >>From my memory of originally writing this, from the old non-moving version, these moves were originally copies. The reason I believe those moves are there is because in some cases the original location is written over. For example trace the behaviour of push_heap / __push_heap. I'm not saying your patch is wrong, and I can't currently compile a g++ svn head to check, but have you run the tester with your patch, and have you checked the logic carefully to make sure you can't scribble over the value in the algorithm? There may will still be a way of reducing the work to just one move of course, at the start of the algorithm. Sorry if you have already considered this, but I remember bits of this being subtle.