diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-06-13 03:26:46 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-06-13 03:26:46 +0000 |
commit | fb03a92c33f36f4bf0492090b8bc1e536e7e82e5 (patch) | |
tree | 04452b36d8766a5da413c6bbcd73d05678b874ad /llvm/lib | |
parent | f4f66f36c7a8b835d7b823c8795def48fcaa2022 (diff) | |
download | bcm5719-llvm-fb03a92c33f36f4bf0492090b8bc1e536e7e82e5.tar.gz bcm5719-llvm-fb03a92c33f36f4bf0492090b8bc1e536e7e82e5.zip |
Be less aggressive about hinting in RAFast.
In particular, don't spill dirty registers only to satisfy a hint. It is
not worth it.
The attached test case provides an example where the fast allocator
would spill a register when other registers are available.
llvm-svn: 132900
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/RegAllocFast.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp index 97652036f98..65ebdf827df 100644 --- a/llvm/lib/CodeGen/RegAllocFast.cpp +++ b/llvm/lib/CodeGen/RegAllocFast.cpp @@ -487,14 +487,12 @@ void RAFast::allocVirtReg(MachineInstr *MI, LiveRegEntry &LRE, unsigned Hint) { // Take hint when possible. if (Hint) { - switch(calcSpillCost(Hint)) { - default: - definePhysReg(MI, Hint, regFree); - // Fall through. - case 0: + // Ignore the hint if we would have to spill a dirty register. + unsigned Cost = calcSpillCost(Hint); + if (Cost < spillDirty) { + if (Cost) + definePhysReg(MI, Hint, regFree); return assignVirtToPhysReg(LRE, Hint); - case spillImpossible: - break; } } |