1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-21 18:22:53 +01:00

[CodeGen] Use range-based for loops (NFC)

This commit is contained in:
Kazu Hirata 2021-02-15 14:46:10 -08:00
parent 4319da4452
commit 5e80e5c119
8 changed files with 24 additions and 36 deletions

View File

@ -952,10 +952,9 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
<< printReg(AntiDepReg, TRI) << ":");
// Handle each group register...
for (std::map<unsigned, unsigned>::iterator
S = RenameMap.begin(), E = RenameMap.end(); S != E; ++S) {
unsigned CurrReg = S->first;
unsigned NewReg = S->second;
for (const auto &P : RenameMap) {
unsigned CurrReg = P.first;
unsigned NewReg = P.second;
LLVM_DEBUG(dbgs() << " " << printReg(CurrReg, TRI) << "->"
<< printReg(NewReg, TRI) << "("

View File

@ -1531,10 +1531,9 @@ void DwarfUnit::constructEnumTypeDIE(DIE &Buffer, const DICompositeType *CTy) {
}
void DwarfUnit::constructContainingTypeDIEs() {
for (auto CI = ContainingTypeMap.begin(), CE = ContainingTypeMap.end();
CI != CE; ++CI) {
DIE &SPDie = *CI->first;
const DINode *D = CI->second;
for (auto &P : ContainingTypeMap) {
DIE &SPDie = *P.first;
const DINode *D = P.second;
if (!D)
continue;
DIE *NDie = getDIE(D);

View File

@ -646,10 +646,9 @@ bool MIRParserImpl::setupRegisterInfo(const PerFunctionMIParsingState &PFS,
}
};
for (auto I = PFS.VRegInfosNamed.begin(), E = PFS.VRegInfosNamed.end();
I != E; I++) {
const VRegInfo &Info = *I->second;
populateVRegInfo(Info, Twine(I->first()));
for (const auto &P : PFS.VRegInfosNamed) {
const VRegInfo &Info = *P.second;
populateVRegInfo(Info, Twine(P.first()));
}
for (auto P : PFS.VRegInfos) {

View File

@ -1086,10 +1086,9 @@ MachineBasicBlock *MachineBasicBlock::SplitCriticalEdge(
I != E; ++I)
NewTerminators.push_back(&*I);
for (SmallVectorImpl<MachineInstr*>::iterator I = Terminators.begin(),
E = Terminators.end(); I != E; ++I) {
if (!is_contained(NewTerminators, *I))
Indexes->removeMachineInstrFromMaps(**I);
for (MachineInstr *Terminator : Terminators) {
if (!is_contained(NewTerminators, Terminator))
Indexes->removeMachineInstrFromMaps(*Terminator);
}
}

View File

@ -850,9 +850,8 @@ int MachineFunction::getFilterIDFor(std::vector<unsigned> &TyIds) {
// If the new filter coincides with the tail of an existing filter, then
// re-use the existing filter. Folding filters more than this requires
// re-ordering filters and/or their elements - probably not worth it.
for (std::vector<unsigned>::iterator I = FilterEnds.begin(),
E = FilterEnds.end(); I != E; ++I) {
unsigned i = *I, j = TyIds.size();
for (unsigned i : FilterEnds) {
unsigned j = TyIds.size();
while (i && j)
if (FilterIds[--i] != TyIds[--j])
@ -1150,11 +1149,9 @@ MachineConstantPool::~MachineConstantPool() {
Deleted.insert(Constants[i].Val.MachineCPVal);
delete Constants[i].Val.MachineCPVal;
}
for (DenseSet<MachineConstantPoolValue*>::iterator I =
MachineCPVsSharingEntries.begin(), E = MachineCPVsSharingEntries.end();
I != E; ++I) {
if (Deleted.count(*I) == 0)
delete *I;
for (MachineConstantPoolValue *CPV : MachineCPVsSharingEntries) {
if (Deleted.count(CPV) == 0)
delete CPV;
}
}

View File

@ -2057,9 +2057,8 @@ void MachineInstr::setPhysRegsDeadExcept(ArrayRef<Register> UsedRegs,
// This is a call with a register mask operand.
// Mask clobbers are always dead, so add defs for the non-dead defines.
if (HasRegMask)
for (ArrayRef<Register>::iterator I = UsedRegs.begin(), E = UsedRegs.end();
I != E; ++I)
addRegisterDefined(*I, &TRI);
for (const Register &UsedReg : UsedRegs)
addRegisterDefined(UsedReg, &TRI);
}
unsigned

View File

@ -47,11 +47,9 @@ bool UnpackMachineBundles::runOnMachineFunction(MachineFunction &MF) {
return false;
bool Changed = false;
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
MachineBasicBlock *MBB = &*I;
for (MachineBasicBlock::instr_iterator MII = MBB->instr_begin(),
MIE = MBB->instr_end(); MII != MIE; ) {
for (MachineBasicBlock &MBB : MF) {
for (MachineBasicBlock::instr_iterator MII = MBB.instr_begin(),
MIE = MBB.instr_end(); MII != MIE; ) {
MachineInstr *MI = &*MII;
// Remove BUNDLE instruction and the InsideBundle flags from bundled
@ -256,8 +254,7 @@ llvm::finalizeBundle(MachineBasicBlock &MBB,
/// MachineFunction. Return true if any bundles are finalized.
bool llvm::finalizeBundles(MachineFunction &MF) {
bool Changed = false;
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {
MachineBasicBlock &MBB = *I;
for (MachineBasicBlock &MBB : MF) {
MachineBasicBlock::instr_iterator MII = MBB.instr_begin();
MachineBasicBlock::instr_iterator MIE = MBB.instr_end();
if (MII == MIE)

View File

@ -518,9 +518,8 @@ void MachineOutliner::findCandidates(
// First, find all of the repeated substrings in the tree of minimum length
// 2.
std::vector<Candidate> CandidatesForRepeatedSeq;
for (auto It = ST.begin(), Et = ST.end(); It != Et; ++It) {
for (const SuffixTree::RepeatedSubstring &RS : ST) {
CandidatesForRepeatedSeq.clear();
SuffixTree::RepeatedSubstring RS = *It;
unsigned StringLen = RS.Length;
for (const unsigned &StartIdx : RS.StartIndices) {
unsigned EndIdx = StartIdx + StringLen - 1;