summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/RegAllocLocal.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-09-03 07:15:37 +0000
committerChris Lattner <sabre@nondot.org>2006-09-03 07:15:37 +0000
commit7cc20d418baf8d5c82ad68174430b2f3dfd8b313 (patch)
tree4517d6735099586b4fe760404aa55483b0c8f75a /llvm/lib/CodeGen/RegAllocLocal.cpp
parent798e9658d79b050a230fbefdc098d88aa976e4fe (diff)
downloadbcm5719-llvm-7cc20d418baf8d5c82ad68174430b2f3dfd8b313.tar.gz
bcm5719-llvm-7cc20d418baf8d5c82ad68174430b2f3dfd8b313.zip
Fix Regression/CodeGen/Generic/2006-09-02-LocalAllocCrash.ll on X86.
Just because an alias of a register is available, it doesn't mean that we can arbitrarily evict the register. llvm-svn: 30064
Diffstat (limited to 'llvm/lib/CodeGen/RegAllocLocal.cpp')
-rw-r--r--llvm/lib/CodeGen/RegAllocLocal.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/RegAllocLocal.cpp b/llvm/lib/CodeGen/RegAllocLocal.cpp
index c435c34f49e..e3f3ab6fa3f 100644
--- a/llvm/lib/CodeGen/RegAllocLocal.cpp
+++ b/llvm/lib/CodeGen/RegAllocLocal.cpp
@@ -103,8 +103,8 @@ namespace {
}
void MarkPhysRegRecentlyUsed(unsigned Reg) {
- if(PhysRegsUseOrder.empty() ||
- PhysRegsUseOrder.back() == Reg) return; // Already most recently used
+ if (PhysRegsUseOrder.empty() ||
+ PhysRegsUseOrder.back() == Reg) return; // Already most recently used
for (unsigned i = PhysRegsUseOrder.size(); i != 0; --i)
if (areRegsEqual(Reg, PhysRegsUseOrder[i-1])) {
@@ -408,10 +408,15 @@ unsigned RA::getReg(MachineBasicBlock &MBB, MachineInstr *I,
} else {
// If one of the registers aliased to the current register is
// compatible, use it.
- for (const unsigned *AliasSet = RegInfo->getAliasSet(R);
- *AliasSet; ++AliasSet) {
- if (RC->contains(*AliasSet)) {
- PhysReg = *AliasSet; // Take an aliased register
+ for (const unsigned *AliasIt = RegInfo->getAliasSet(R);
+ *AliasIt; ++AliasIt) {
+ if (RC->contains(*AliasIt) &&
+ // If this is pinned down for some reason, don't use it. For
+ // example, if CL is pinned, and we run across CH, don't use
+ // CH as justification for using scavenging ECX (which will
+ // fail).
+ PhysRegsUsed[*AliasIt] != 0) {
+ PhysReg = *AliasIt; // Take an aliased register
break;
}
}
OpenPOWER on IntegriCloud