From: David Blaikie Date: Thu, 27 Mar 2014 23:42:21 +0000 (+0000) Subject: PBQP: Minor cleanups to r204857 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=2559cde2e88ea9ee8303e74469910677fb8f39c5;p=oota-llvm.git PBQP: Minor cleanups to r204857 * Use assignment instead of swap (since the original value is being destroyed anyway) * Rename "updateAdjEdgeId" to "setAdjEdgeId" git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204983 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/PBQP/Graph.h b/include/llvm/CodeGen/PBQP/Graph.h index e414c225518..5aac2169316 100644 --- a/include/llvm/CodeGen/PBQP/Graph.h +++ b/include/llvm/CodeGen/PBQP/Graph.h @@ -70,12 +70,12 @@ namespace PBQP { void removeAdjEdgeId(Graph &G, NodeId ThisNId, AdjEdgeIdx Idx) { // Swap-and-pop for fast removal. // 1) Update the adj index of the edge currently at back(). - // 2) Swap Edge at Idx with back(). + // 2) Move last Edge down to Idx. // 3) pop_back() - // If Idx == size() - 1 then the updateAdjEdgeIdx and swap are + // If Idx == size() - 1 then the setAdjEdgeIdx and swap are // redundant, but both operations are cheap. - G.getEdge(AdjEdgeIds.back()).updateAdjEdgeIdx(ThisNId, Idx); - std::swap(AdjEdgeIds[Idx], AdjEdgeIds.back()); + G.getEdge(AdjEdgeIds.back()).setAdjEdgeIdx(ThisNId, Idx); + AdjEdgeIds[Idx] = AdjEdgeIds.back(); AdjEdgeIds.pop_back(); } @@ -125,7 +125,7 @@ namespace PBQP { connectToN(G, ThisEdgeId, 1); } - void updateAdjEdgeIdx(NodeId NId, typename NodeEntry::AdjEdgeIdx NewIdx) { + void setAdjEdgeIdx(NodeId NId, typename NodeEntry::AdjEdgeIdx NewIdx) { if (NId == NIds[0]) ThisEdgeAdjIdxs[0] = NewIdx; else {