In the patch https://reviews.llvm.org/D78849, it uses llvm::any_of to instead of for loop to simplify the function addRequired ():
Below function
bool addRequired(const RegSet &RS) { bool changed = false; for (RegSet::const_iterator I = RS.begin(), E = RS.end(); I != E; ++I) if (addRequired(*I)) changed = true; return changed; }
will be simplified to:
bool addRequired(const RegSet &RS) { return llvm::any_of( RS, [this](unsigned Reg) { return this->addRequired(Reg); }); }
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 all element to call addRequired(Reg).
This bug has caused 248 cases error for the Machine Verfication of LiveVariable pass.
This patch uses for range loop to fix llvm::any_of bug.
s/const auto &/unsigned/