diff options
author | Owen Anderson <resistor@mac.com> | 2008-07-10 01:53:01 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-07-10 01:53:01 +0000 |
commit | ecee36ece65957e3756ec63b6413eac25fff1b24 (patch) | |
tree | 5ccbad4647f6302d54fddbb64c0edef304d06e50 /lib/CodeGen/RegAllocLocal.cpp | |
parent | c007848b5aa0883715b3cf0ded82f7bff750896b (diff) | |
download | external_llvm-ecee36ece65957e3756ec63b6413eac25fff1b24.zip external_llvm-ecee36ece65957e3756ec63b6413eac25fff1b24.tar.gz external_llvm-ecee36ece65957e3756ec63b6413eac25fff1b24.tar.bz2 |
Fix 403.gcc. Finally got the check for two-address-ness correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53389 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/RegAllocLocal.cpp')
-rw-r--r-- | lib/CodeGen/RegAllocLocal.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp index 3e1038d..c3d4442 100644 --- a/lib/CodeGen/RegAllocLocal.cpp +++ b/lib/CodeGen/RegAllocLocal.cpp @@ -589,20 +589,24 @@ void RALocal::ComputeLocalLiveness(MachineBasicBlock& MBB) { std::map<unsigned, std::pair<MachineInstr*, unsigned> >::iterator last = LastUseDef.find(MO.getReg()); if (last != LastUseDef.end()) { - - // If this is a two address instr, then we don't mark the def - // as killing the use. - if (last->second.first == I && - I->getDesc().getOperandConstraint(last->second.second, - TOI::TIED_TO) == (signed)i) { - LastUseDef[MO.getReg()] = std::make_pair(I, i); - continue; + // Check if this is a two address instruction. If so, then + // the def does not kill the use. + if (last->second.first == I) { + bool isTwoAddr = false; + for (unsigned j = i+1, je = I->getDesc().getNumOperands(); + j < je; ++j) { + const MachineOperand &MO2 = I->getOperand(j); + if (MO2.isRegister() && MO2.isUse() && + MO2.getReg() == MO.getReg() && + I->getDesc().getOperandConstraint(j, TOI::TIED_TO) == (int)i) + isTwoAddr = true; + } + + if (isTwoAddr) continue; } - MachineOperand& lastUD = last->second.first->getOperand(last->second.second); - if (lastUD.isDef()) lastUD.setIsDead(true); else if (lastUD.isUse()) |