summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-02 22:12:55 +0000
committerDan Gohman <gohman@apple.com>2008-07-02 22:12:55 +0000
commit1b46bfecfe6d26544666e081694f963d8bc10dd1 (patch)
tree7eeaaeae3aa6b0c7288d27ad5cc3e84877ed320c /llvm/lib
parent8c10c2482abcfb296d4020123b44443cb3ca1b60 (diff)
downloadbcm5719-llvm-1b46bfecfe6d26544666e081694f963d8bc10dd1.tar.gz
bcm5719-llvm-1b46bfecfe6d26544666e081694f963d8bc10dd1.zip
Revert r52988. It broke 254.gap on x86-64.
llvm-svn: 53050
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 8e9933c7a73..75b2c9865ec 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -738,7 +738,7 @@ bool MachineInstr::addRegisterKilled(unsigned IncomingReg,
const TargetRegisterInfo *RegInfo,
bool AddIfNotFound) {
bool isPhysReg = TargetRegisterInfo::isPhysicalRegister(IncomingReg);
- bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg);
+ bool Found = false;
SmallVector<unsigned,4> DeadOps;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
MachineOperand &MO = getOperand(i);
@@ -749,15 +749,15 @@ bool MachineInstr::addRegisterKilled(unsigned IncomingReg,
continue;
if (Reg == IncomingReg) {
- MO.setIsKill();
- return true;
- }
- if (hasAliases && MO.isKill() &&
- TargetRegisterInfo::isPhysicalRegister(Reg)) {
+ if (!Found) // One kill of reg per instruction.
+ MO.setIsKill();
+ Found = true;
+ } else if (isPhysReg && MO.isKill() &&
+ TargetRegisterInfo::isPhysicalRegister(Reg)) {
// A super-register kill already exists.
if (RegInfo->isSuperRegister(IncomingReg, Reg))
- return true;
- if (RegInfo->isSubRegister(IncomingReg, Reg))
+ Found = true;
+ else if (RegInfo->isSubRegister(IncomingReg, Reg))
DeadOps.push_back(i);
}
}
@@ -774,14 +774,14 @@ bool MachineInstr::addRegisterKilled(unsigned IncomingReg,
// If not found, this means an alias of one of the operands is killed. Add a
// new implicit operand if required.
- if (AddIfNotFound) {
+ if (!Found && AddIfNotFound) {
addOperand(MachineOperand::CreateReg(IncomingReg,
false /*IsDef*/,
true /*IsImp*/,
true /*IsKill*/));
return true;
}
- return false;
+ return Found;
}
bool MachineInstr::addRegisterDead(unsigned IncomingReg,
@@ -789,6 +789,7 @@ bool MachineInstr::addRegisterDead(unsigned IncomingReg,
bool AddIfNotFound) {
bool isPhysReg = TargetRegisterInfo::isPhysicalRegister(IncomingReg);
bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg);
+ bool Found = false;
SmallVector<unsigned,4> DeadOps;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) {
MachineOperand &MO = getOperand(i);
@@ -797,14 +798,13 @@ bool MachineInstr::addRegisterDead(unsigned IncomingReg,
unsigned Reg = MO.getReg();
if (Reg == IncomingReg) {
MO.setIsDead();
- return true;
- }
- if (hasAliases && MO.isDead() &&
- TargetRegisterInfo::isPhysicalRegister(Reg)) {
+ Found = true;
+ } else if (hasAliases && MO.isDead() &&
+ TargetRegisterInfo::isPhysicalRegister(Reg)) {
// There exists a super-register that's marked dead.
if (RegInfo->isSuperRegister(IncomingReg, Reg))
- return true;
- if (RegInfo->isSubRegister(IncomingReg, Reg))
+ Found = true;
+ else if (RegInfo->isSubRegister(IncomingReg, Reg))
DeadOps.push_back(i);
}
}
@@ -821,13 +821,13 @@ bool MachineInstr::addRegisterDead(unsigned IncomingReg,
// If not found, this means an alias of one of the operand is dead. Add a
// new implicit operand.
- if (AddIfNotFound) {
+ if (!Found && AddIfNotFound) {
addOperand(MachineOperand::CreateReg(IncomingReg, true/*IsDef*/,
true/*IsImp*/,false/*IsKill*/,
true/*IsDead*/));
return true;
}
- return false;
+ return Found;
}
/// copyKillDeadInfo - copies killed/dead information from one instr to another
OpenPOWER on IntegriCloud