[llvm] r204864 - Add comments. Addressing review comments from Evan on r204690.

Manman Ren manman.ren at gmail.com
Wed Mar 26 15:14:09 PDT 2014


Author: mren
Date: Wed Mar 26 17:14:09 2014
New Revision: 204864

URL: http://llvm.org/viewvc/llvm-project?rev=204864&view=rev
Log:
Add comments. Addressing review comments from Evan on r204690.

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

Modified: llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp?rev=204864&r1=204863&r2=204864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp (original)
+++ llvm/trunk/lib/CodeGen/RegAllocGreedy.cpp Wed Mar 26 17:14:09 2014
@@ -2122,6 +2122,11 @@ unsigned RAGreedy::selectOrSplitImpl(Liv
         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





More information about the llvm-commits mailing list