From c0981da47d5696fe36474fcf86b4ce03ae3ff818 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Fri, 19 Nov 2021 21:06:13 +0100 Subject: Vendor import of llvm-project main llvmorg-14-init-10186-gff7f2cfa959b. --- llvm/lib/CodeGen/LivePhysRegs.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'llvm/lib/CodeGen/LivePhysRegs.cpp') diff --git a/llvm/lib/CodeGen/LivePhysRegs.cpp b/llvm/lib/CodeGen/LivePhysRegs.cpp index c0c7848139e4..d4848f16dcf2 100644 --- a/llvm/lib/CodeGen/LivePhysRegs.cpp +++ b/llvm/lib/CodeGen/LivePhysRegs.cpp @@ -81,22 +81,24 @@ void LivePhysRegs::stepForward(const MachineInstr &MI, SmallVectorImpl> &Clobbers) { // Remove killed registers from the set. for (ConstMIBundleOperands O(MI); O.isValid(); ++O) { - if (O->isReg() && !O->isDebug()) { + if (O->isReg()) { + if (O->isDebug()) + continue; Register Reg = O->getReg(); - if (!Register::isPhysicalRegister(Reg)) + if (!Reg.isPhysical()) continue; if (O->isDef()) { // Note, dead defs are still recorded. The caller should decide how to // handle them. Clobbers.push_back(std::make_pair(Reg, &*O)); } else { - if (!O->isKill()) - continue; assert(O->isUse()); - removeReg(Reg); + if (O->isKill()) + removeReg(Reg); } - } else if (O->isRegMask()) + } else if (O->isRegMask()) { removeRegsInMask(*O, &Clobbers); + } } // Add defs to the set. @@ -250,7 +252,7 @@ void llvm::computeLiveIns(LivePhysRegs &LiveRegs, const TargetRegisterInfo &TRI = *MRI.getTargetRegisterInfo(); LiveRegs.init(TRI); LiveRegs.addLiveOutsNoPristines(MBB); - for (const MachineInstr &MI : make_range(MBB.rbegin(), MBB.rend())) + for (const MachineInstr &MI : llvm::reverse(MBB)) LiveRegs.stepBackward(MI); } @@ -287,7 +289,7 @@ void llvm::recomputeLivenessFlags(MachineBasicBlock &MBB) { LiveRegs.init(TRI); LiveRegs.addLiveOutsNoPristines(MBB); - for (MachineInstr &MI : make_range(MBB.rbegin(), MBB.rend())) { + for (MachineInstr &MI : llvm::reverse(MBB)) { // Recompute dead flags. for (MIBundleOperands MO(MI); MO.isValid(); ++MO) { if (!MO->isReg() || !MO->isDef() || MO->isDebug()) @@ -296,7 +298,7 @@ void llvm::recomputeLivenessFlags(MachineBasicBlock &MBB) { Register Reg = MO->getReg(); if (Reg == 0) continue; - assert(Register::isPhysicalRegister(Reg)); + assert(Reg.isPhysical()); bool IsNotLive = LiveRegs.available(MRI, Reg); @@ -325,7 +327,7 @@ void llvm::recomputeLivenessFlags(MachineBasicBlock &MBB) { Register Reg = MO->getReg(); if (Reg == 0) continue; - assert(Register::isPhysicalRegister(Reg)); + assert(Reg.isPhysical()); bool IsNotLive = LiveRegs.available(MRI, Reg); MO->setIsKill(IsNotLive); -- cgit v1.3