[CodeGen] Remove atEnd method from defusechain iterators (#120610)
This was not used much and there are better ways of writing it.
This commit is contained in:
@@ -1095,9 +1095,6 @@ public:
|
||||
return !operator==(x);
|
||||
}
|
||||
|
||||
/// atEnd - return true if this iterator is equal to reg_end() on the value.
|
||||
bool atEnd() const { return Op == nullptr; }
|
||||
|
||||
// Iterator traversal: forward iteration only
|
||||
defusechain_iterator &operator++() { // Preincrement
|
||||
assert(Op && "Cannot increment end iterator!");
|
||||
@@ -1203,9 +1200,6 @@ public:
|
||||
return !operator==(x);
|
||||
}
|
||||
|
||||
/// atEnd - return true if this iterator is equal to reg_end() on the value.
|
||||
bool atEnd() const { return Op == nullptr; }
|
||||
|
||||
// Iterator traversal: forward iteration only
|
||||
defusechain_instr_iterator &operator++() { // Preincrement
|
||||
assert(Op && "Cannot increment end iterator!");
|
||||
|
||||
@@ -407,9 +407,11 @@ void MachineRegisterInfo::replaceRegWith(Register FromReg, Register ToReg) {
|
||||
MachineInstr *MachineRegisterInfo::getVRegDef(Register Reg) const {
|
||||
// Since we are in SSA form, we can use the first definition.
|
||||
def_instr_iterator I = def_instr_begin(Reg);
|
||||
assert((I.atEnd() || std::next(I) == def_instr_end()) &&
|
||||
"getVRegDef assumes a single definition or no definition");
|
||||
return !I.atEnd() ? &*I : nullptr;
|
||||
if (I == def_instr_end())
|
||||
return nullptr;
|
||||
assert(std::next(I) == def_instr_end() &&
|
||||
"getVRegDef assumes at most one definition");
|
||||
return &*I;
|
||||
}
|
||||
|
||||
/// getUniqueVRegDef - Return the unique machine instr that defines the
|
||||
|
||||
@@ -683,11 +683,10 @@ struct DataDep {
|
||||
DataDep(const MachineRegisterInfo *MRI, unsigned VirtReg, unsigned UseOp)
|
||||
: UseOp(UseOp) {
|
||||
assert(Register::isVirtualRegister(VirtReg));
|
||||
MachineRegisterInfo::def_iterator DefI = MRI->def_begin(VirtReg);
|
||||
assert(!DefI.atEnd() && "Register has no defs");
|
||||
DefMI = DefI->getParent();
|
||||
DefOp = DefI.getOperandNo();
|
||||
assert((++DefI).atEnd() && "Register has multiple defs");
|
||||
MachineOperand *DefMO = MRI->getOneDef(VirtReg);
|
||||
assert(DefMO && "Register does not have unique def");
|
||||
DefMI = DefMO->getParent();
|
||||
DefOp = DefMO->getOperandNo();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ void SwiftErrorValueTracking::propagateVRegs() {
|
||||
for (const auto &Use : VRegUpwardsUse) {
|
||||
const MachineBasicBlock *UseBB = Use.first.first;
|
||||
Register VReg = Use.second;
|
||||
if (!MRI.def_begin(VReg).atEnd())
|
||||
if (!MRI.def_empty(VReg))
|
||||
continue;
|
||||
|
||||
#ifdef EXPENSIVE_CHECKS
|
||||
|
||||
Reference in New Issue
Block a user