From: Arnaud A. de Grandmaison Date: Tue, 21 Oct 2014 16:24:15 +0000 (+0000) Subject: [PBQP] Fix coalescing benefits X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3648d0cbebfd7950329c793342ea8d12860e0fd;p=platform%2Fupstream%2Fllvm.git [PBQP] Fix coalescing benefits As coalescing registers is a benefit, the cost should be improved (i.e. made smaller) when coalescing is possible. llvm-svn: 220302 --- diff --git a/llvm/lib/CodeGen/RegAllocPBQP.cpp b/llvm/lib/CodeGen/RegAllocPBQP.cpp index 599fbad..5bd3374 100644 --- a/llvm/lib/CodeGen/RegAllocPBQP.cpp +++ b/llvm/lib/CodeGen/RegAllocPBQP.cpp @@ -350,7 +350,7 @@ public: if (PRegOpt < Allowed.size()) { PBQPRAGraph::RawVector NewCosts(G.getNodeCosts(NId)); - NewCosts[PRegOpt + 1] += CBenefit; + NewCosts[PRegOpt + 1] -= CBenefit; G.setNodeCosts(NId, std::move(NewCosts)); } } else { @@ -395,7 +395,7 @@ private: for (unsigned J = 0; J != Allowed2.size(); ++J) { unsigned PReg2 = Allowed2[J]; if (PReg1 == PReg2) - CostMat[I + 1][J + 1] += -Benefit; + CostMat[I + 1][J + 1] -= Benefit; } } }