aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/RegAllocFast.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2010-06-15 16:20:57 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2010-06-15 16:20:57 +0000
commit75ac4d9c2dfb22f84da25dec03df7a07f3dad1fa (patch)
treeeb321bdb0c71a18d3b941bcf8440fee2b8b5d231 /lib/CodeGen/RegAllocFast.cpp
parent40d07bbebbe73914af28be1bdab169ce8333adca (diff)
Avoid processing early clobbers twice in RegAllocFast.
Early clobbers defining a virtual register were first alocated to a physreg and then processed as a physreg EC, spilling the virtreg. This fixes PR7382. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105998 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocFast.cpp')
-rw-r--r--lib/CodeGen/RegAllocFast.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/RegAllocFast.cpp b/lib/CodeGen/RegAllocFast.cpp
index 41a3545f04..ea8d4229d9 100644
--- a/lib/CodeGen/RegAllocFast.cpp
+++ b/lib/CodeGen/RegAllocFast.cpp
@@ -708,7 +708,8 @@ void RAFast::AllocateBasicBlock() {
if (MO.isUse()) {
usePhysReg(MO);
} else if (MO.isEarlyClobber()) {
- definePhysReg(MI, Reg, MO.isDead() ? regFree : regReserved);
+ definePhysReg(MI, Reg, (MO.isImplicit() || MO.isDead()) ?
+ regFree : regReserved);
PhysECs.push_back(Reg);
}
}
@@ -731,8 +732,11 @@ void RAFast::AllocateBasicBlock() {
// Note: defineVirtReg may invalidate MO.
LiveRegMap::iterator LRI = defineVirtReg(MI, i, Reg, 0);
unsigned PhysReg = LRI->second.PhysReg;
- setPhysReg(MI, i, PhysReg);
+ if (setPhysReg(MI, i, PhysReg))
+ VirtDead.push_back(Reg);
PhysECs.push_back(PhysReg);
+ // Don't attempt coalescing when earlyclobbers are present.
+ CopyDst = 0;
}
}
@@ -767,7 +771,8 @@ void RAFast::AllocateBasicBlock() {
// Allocate defs and collect dead defs.
for (unsigned i = 0; i != DefOpEnd; ++i) {
MachineOperand &MO = MI->getOperand(i);
- if (!MO.isReg() || !MO.isDef() || !MO.getReg()) continue;
+ if (!MO.isReg() || !MO.isDef() || !MO.getReg() || MO.isEarlyClobber())
+ continue;
unsigned Reg = MO.getReg();
if (TargetRegisterInfo::isPhysicalRegister(Reg)) {