diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-07-06 21:34:05 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-07-06 21:34:05 +0000 |
commit | ba2410b7caa4968c3a91697acea4b3fa17ca94c1 (patch) | |
tree | 2303c7b48c882a65d7b0627fb294d6c12f69c529 /llvm/lib/CodeGen/LiveVariables.cpp | |
parent | 2370b4d81f0ada950816a2c2dd859057a86871c8 (diff) | |
download | bcm5719-llvm-ba2410b7caa4968c3a91697acea4b3fa17ca94c1.tar.gz bcm5719-llvm-ba2410b7caa4968c3a91697acea4b3fa17ca94c1.zip |
Avoid adding a duplicate def. This fixes PR4478.
llvm-svn: 74857
Diffstat (limited to 'llvm/lib/CodeGen/LiveVariables.cpp')
-rw-r--r-- | llvm/lib/CodeGen/LiveVariables.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/LiveVariables.cpp b/llvm/lib/CodeGen/LiveVariables.cpp index bd845085bbf..bb72d80cb6e 100644 --- a/llvm/lib/CodeGen/LiveVariables.cpp +++ b/llvm/lib/CodeGen/LiveVariables.cpp @@ -369,8 +369,17 @@ bool LiveVariables::HandlePhysRegKill(unsigned Reg, MachineInstr *MI) { for (const unsigned *SubRegs = TRI->getSubRegisters(Reg); unsigned SubReg = *SubRegs; ++SubRegs) { if (PartUses.count(SubReg)) { - PhysRegDef[Reg]->addOperand(MachineOperand::CreateReg(SubReg, - true, true)); + bool NeedDef = true; + if (PhysRegDef[Reg] == PhysRegDef[SubReg]) { + MachineOperand *MO = PhysRegDef[Reg]->findRegisterDefOperand(SubReg); + if (MO) { + NeedDef = false; + assert(!MO->isDead()); + } + } + if (NeedDef) + PhysRegDef[Reg]->addOperand(MachineOperand::CreateReg(SubReg, + true, true)); LastRefOrPartRef->addRegisterKilled(SubReg, TRI, true); for (const unsigned *SS = TRI->getSubRegisters(SubReg); *SS; ++SS) PartUses.erase(*SS); |