summaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocGreedy.cpp
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2014-03-26 22:14:09 +0000
committerManman Ren <manman.ren@gmail.com>2014-03-26 22:14:09 +0000
commit3d7d0bc71a858bdd251a84f7a58a379894afe118 (patch)
treea44b079b2c0dc89dbd5a8a26447cd245248247df /lib/CodeGen/RegAllocGreedy.cpp
parent2a6873fdf3fa413cd7ef09b368fab64aa936d027 (diff)
downloadllvm-3d7d0bc71a858bdd251a84f7a58a379894afe118.tar.gz
llvm-3d7d0bc71a858bdd251a84f7a58a379894afe118.tar.bz2
llvm-3d7d0bc71a858bdd251a84f7a58a379894afe118.tar.xz
Add comments. Addressing review comments from Evan on r204690.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocGreedy.cpp')
-rw-r--r--lib/CodeGen/RegAllocGreedy.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/CodeGen/RegAllocGreedy.cpp b/lib/CodeGen/RegAllocGreedy.cpp
index 3a4ad620d0..a4f6b682a2 100644
--- a/lib/CodeGen/RegAllocGreedy.cpp
+++ b/lib/CodeGen/RegAllocGreedy.cpp
@@ -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