Add comments. Addressing review comments from Evan on r204690.
authorManman Ren <manman.ren@gmail.com>
Wed, 26 Mar 2014 22:14:09 +0000 (22:14 +0000)
committerManman Ren <manman.ren@gmail.com>
Wed, 26 Mar 2014 22:14:09 +0000 (22:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204864 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/RegAllocGreedy.cpp

index 3a4ad620d073633b8f6954b22379438586a60d27..a4f6b682a23f39ccc15a38309ca86d331f408241 100644 (file)
@@ -2122,6 +2122,11 @@ unsigned RAGreedy::selectOrSplitImpl(LiveInterval &VirtReg,
         CSRFirstUse = true;
 
     BlockFrequency CSRCost(CSRFirstTimeCost);
+    // Using a CSR for the first time has a cost because it causes push|pop
+    // to be added to prologue|epilogue. Splitting a cold section of the live
+    // range can have lower cost than using the CSR for the first time;
+    // Spilling a live range in the cold path can have lower cost than using
+    // the CSR for the first time.
     if (getStage(VirtReg) == RS_Spill && CSRFirstUse && NewVRegs.empty() &&
         CSRFirstTimeCost > 0 && VirtReg.isSpillable()) {
       // We choose spill over using the CSR for the first time if the spill cost