diff options
Diffstat (limited to 'contrib/llvm/lib/CodeGen/LivePhysRegs.cpp')
-rw-r--r-- | contrib/llvm/lib/CodeGen/LivePhysRegs.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/llvm/lib/CodeGen/LivePhysRegs.cpp b/contrib/llvm/lib/CodeGen/LivePhysRegs.cpp index 277212cf7dac..86c6c8e29f9a 100644 --- a/contrib/llvm/lib/CodeGen/LivePhysRegs.cpp +++ b/contrib/llvm/lib/CodeGen/LivePhysRegs.cpp @@ -18,12 +18,13 @@ #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBundle.h" #include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/Config/llvm-config.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; -/// \brief Remove all registers from the set that get clobbered by the register +/// Remove all registers from the set that get clobbered by the register /// mask. /// The clobbers set will be the list of live registers clobbered /// by the regmask. @@ -44,7 +45,7 @@ void LivePhysRegs::removeRegsInMask(const MachineOperand &MO, void LivePhysRegs::removeDefs(const MachineInstr &MI) { for (ConstMIBundleOperands O(MI); O.isValid(); ++O) { if (O->isReg()) { - if (!O->isDef()) + if (!O->isDef() || O->isDebug()) continue; unsigned Reg = O->getReg(); if (!TargetRegisterInfo::isPhysicalRegister(Reg)) @@ -58,7 +59,7 @@ void LivePhysRegs::removeDefs(const MachineInstr &MI) { /// Add uses to the set. void LivePhysRegs::addUses(const MachineInstr &MI) { for (ConstMIBundleOperands O(MI); O.isValid(); ++O) { - if (!O->isReg() || !O->readsReg()) + if (!O->isReg() || !O->readsReg() || O->isDebug()) continue; unsigned Reg = O->getReg(); if (!TargetRegisterInfo::isPhysicalRegister(Reg)) @@ -85,7 +86,7 @@ void LivePhysRegs::stepForward(const MachineInstr &MI, SmallVectorImpl<std::pair<unsigned, const MachineOperand*>> &Clobbers) { // Remove killed registers from the set. for (ConstMIBundleOperands O(MI); O.isValid(); ++O) { - if (O->isReg()) { + if (O->isReg() && !O->isDebug()) { unsigned Reg = O->getReg(); if (!TargetRegisterInfo::isPhysicalRegister(Reg)) continue; @@ -105,9 +106,13 @@ void LivePhysRegs::stepForward(const MachineInstr &MI, // Add defs to the set. for (auto Reg : Clobbers) { - // Skip dead defs. They shouldn't be added to the set. + // Skip dead defs and registers clobbered by regmasks. They shouldn't + // be added to the set. if (Reg.second->isReg() && Reg.second->isDead()) continue; + if (Reg.second->isRegMask() && + MachineOperand::clobbersPhysReg(Reg.second->getRegMask(), Reg.first)) + continue; addReg(Reg.first); } } |