forked from OSchip/llvm-project
[MachineVerifier] Use the for_range loop to instead llvm::any_of
Summary: In the patch D78849, it uses llvm::any_of to instead of for loop to simplify the function addRequired(). It's obvious that above code is not a NFC conversion. Because any_of will return if any addRequired(Reg) is true immediately, but we want every element to call addRequired(Reg). This patch uses for_range loop to fix above any_of bug. Reviewed By: MaskRay, nickdesaulniers Differential Revision: https://reviews.llvm.org/D79872
This commit is contained in:
parent
dad2e92eaf
commit
aedb6615a8
|
@ -168,14 +168,18 @@ namespace {
|
|||
|
||||
// Same for a full set.
|
||||
bool addRequired(const RegSet &RS) {
|
||||
return llvm::any_of(
|
||||
RS, [this](unsigned Reg) { return this->addRequired(Reg); });
|
||||
bool Changed = false;
|
||||
for (unsigned Reg : RS)
|
||||
Changed |= addRequired(Reg);
|
||||
return Changed;
|
||||
}
|
||||
|
||||
// Same for a full map.
|
||||
bool addRequired(const RegMap &RM) {
|
||||
return llvm::any_of(
|
||||
RM, [this](const auto &P) { return this->addRequired(P.first); });
|
||||
bool Changed = false;
|
||||
for (const auto &I : RM)
|
||||
Changed |= addRequired(I.first);
|
||||
return Changed;
|
||||
}
|
||||
|
||||
// Live-out registers are either in regsLiveOut or vregsPassed.
|
||||
|
|
Loading…
Reference in New Issue