diff --git a/llvm/utils/TableGen/DXILEmitter.cpp b/llvm/utils/TableGen/DXILEmitter.cpp index 0b553c3a3d456..0364b02c2483d 100644 --- a/llvm/utils/TableGen/DXILEmitter.cpp +++ b/llvm/utils/TableGen/DXILEmitter.cpp @@ -113,9 +113,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) { ParamTypeRecs.push_back(R->getValueAsDef("result")); - for (const Record *ArgTy : R->getValueAsListOfDefs("arguments")) { - ParamTypeRecs.push_back(ArgTy); - } + llvm::append_range(ParamTypeRecs, R->getValueAsListOfDefs("arguments")); size_t ParamTypeRecsSize = ParamTypeRecs.size(); // Populate OpTypes with return type and parameter types @@ -148,9 +146,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) { // Sort records in ascending order of DXIL version ascendingSortByVersion(Recs); - for (const Record *CR : Recs) { - OverloadRecs.push_back(CR); - } + llvm::append_range(OverloadRecs, Recs); // Get stage records Recs = R->getValueAsListOfDefs("stages"); @@ -163,9 +159,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) { // Sort records in ascending order of DXIL version ascendingSortByVersion(Recs); - for (const Record *CR : Recs) { - StageRecs.push_back(CR); - } + llvm::append_range(StageRecs, Recs); // Get attribute records Recs = R->getValueAsListOfDefs("attributes"); @@ -173,9 +167,7 @@ DXILOperationDesc::DXILOperationDesc(const Record *R) { // Sort records in ascending order of DXIL version ascendingSortByVersion(Recs); - for (const Record *CR : Recs) { - AttrRecs.push_back(CR); - } + llvm::append_range(AttrRecs, Recs); // Get the operation class OpClass = R->getValueAsDef("OpClass")->getName(); diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp index e1344ae54b20e..cf7c02db8842e 100644 --- a/llvm/utils/TableGen/DecoderEmitter.cpp +++ b/llvm/utils/TableGen/DecoderEmitter.cpp @@ -1342,8 +1342,7 @@ void FilterChooser::emitPredicateTableEntry(DecoderTableInfo &TableInfo, TableInfo.Table.push_back(MCD::OPC_CheckPredicate); // Predicate index. - for (const auto PB : PBytes) - TableInfo.Table.push_back(PB); + llvm::append_range(TableInfo.Table, PBytes); // Push location for NumToSkip backpatching. TableInfo.FixupStack.back().push_back(TableInfo.Table.size()); TableInfo.Table.push_back(0); @@ -1402,15 +1401,13 @@ void FilterChooser::emitSoftFailTableEntry(DecoderTableInfo &TableInfo, raw_svector_ostream S(MaskBytes); if (NeedPositiveMask) { encodeULEB128(PositiveMask.getZExtValue(), S); - for (unsigned i = 0, e = MaskBytes.size(); i != e; ++i) - TableInfo.Table.push_back(MaskBytes[i]); + llvm::append_range(TableInfo.Table, MaskBytes); } else TableInfo.Table.push_back(0); if (NeedNegativeMask) { MaskBytes.clear(); encodeULEB128(NegativeMask.getZExtValue(), S); - for (unsigned i = 0, e = MaskBytes.size(); i != e; ++i) - TableInfo.Table.push_back(MaskBytes[i]); + llvm::append_range(TableInfo.Table, MaskBytes); } else TableInfo.Table.push_back(0); } @@ -1483,8 +1480,7 @@ void FilterChooser::emitSingletonTableEntry(DecoderTableInfo &TableInfo, encodeULEB128(DIdx, S); // Decoder index. - for (const auto B : Bytes) - TableInfo.Table.push_back(B); + llvm::append_range(TableInfo.Table, Bytes); if (!HasCompleteDecoder) { // Push location for NumToSkip backpatching. diff --git a/llvm/utils/TableGen/X86DisassemblerTables.cpp b/llvm/utils/TableGen/X86DisassemblerTables.cpp index 5e7983a101e0b..36f752a1ebe63 100644 --- a/llvm/utils/TableGen/X86DisassemblerTables.cpp +++ b/llvm/utils/TableGen/X86DisassemblerTables.cpp @@ -746,8 +746,7 @@ void DisassemblerTables::emitModRMDecision(raw_ostream &o1, raw_ostream &o2, ModRMDecision.push_back(decision.instructionIDs[index]); break; case MODRM_FULL: - for (unsigned short InstructionID : decision.instructionIDs) - ModRMDecision.push_back(InstructionID); + llvm::append_range(ModRMDecision, decision.instructionIDs); break; }