[llvm] r220302 - [PBQP] Fix coalescing benefits

Arnaud A. de Grandmaison arnaud.degrandmaison at arm.com
Tue Oct 21 09:24:16 PDT 2014


Author: aadg
Date: Tue Oct 21 11:24:15 2014
New Revision: 220302

URL: http://llvm.org/viewvc/llvm-project?rev=220302&view=rev
Log:
[PBQP] Fix coalescing benefits

As coalescing registers is a benefit, the cost should be improved (i.e. made smaller) when coalescing is possible.

Modified:
    llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp

Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=220302&r1=220301&r2=220302&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Tue Oct 21 11:24:15 2014
@@ -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;
       }
     }
   }





More information about the llvm-commits mailing list