[BOLT][NFC] Use llvm::reverse

Use llvm::reverse instead of `for (auto I = rbegin(), E = rend(); I != E; ++I)`

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D140516
This commit is contained in:
Amir Ayupov
2023-01-03 17:31:44 -08:00
parent bf4596bf58
commit f40d25dd8d
10 changed files with 73 additions and 87 deletions

View File

@@ -198,14 +198,13 @@ int32_t BinaryBasicBlock::getCFIStateAtInstr(const MCInst *Instr) const {
// Find the last CFI preceding Instr in this basic block.
const MCInst *LastCFI = nullptr;
bool InstrSeen = (Instr == nullptr);
for (auto RII = Instructions.rbegin(), E = Instructions.rend(); RII != E;
++RII) {
for (const MCInst &Inst : llvm::reverse(Instructions)) {
if (!InstrSeen) {
InstrSeen = (&*RII == Instr);
InstrSeen = (&Inst == Instr);
continue;
}
if (Function->getBinaryContext().MIB->isCFI(*RII)) {
LastCFI = &*RII;
if (Function->getBinaryContext().MIB->isCFI(Inst)) {
LastCFI = &Inst;
break;
}
}