1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[llvm] Use llvm::append_range (NFC)

This commit is contained in:
Kazu Hirata 2021-01-06 18:27:33 -08:00
parent 871d4c4165
commit 3109d596ee
20 changed files with 34 additions and 40 deletions

View File

@ -229,7 +229,7 @@ public:
if (*Node == N) if (*Node == N)
continue; continue;
Node->findEdgesTo(N, TempList); Node->findEdgesTo(N, TempList);
EL.insert(EL.end(), TempList.begin(), TempList.end()); llvm::append_range(EL, TempList);
TempList.clear(); TempList.clear();
} }
return !EL.empty(); return !EL.empty();

View File

@ -1126,7 +1126,7 @@ public:
explicit OperandBundleDefT(const OperandBundleUse &OBU) { explicit OperandBundleDefT(const OperandBundleUse &OBU) {
Tag = std::string(OBU.getTagName()); Tag = std::string(OBU.getTagName());
Inputs.insert(Inputs.end(), OBU.Inputs.begin(), OBU.Inputs.end()); llvm::append_range(Inputs, OBU.Inputs);
} }
ArrayRef<InputTy> inputs() const { return Inputs; } ArrayRef<InputTy> inputs() const { return Inputs; }

View File

@ -152,7 +152,7 @@ public:
// Add children present in the snapshot for not in the real CFG. // Add children present in the snapshot for not in the real CFG.
auto &AddedChildren = It->second.DI[1]; auto &AddedChildren = It->second.DI[1];
Res.insert(Res.end(), AddedChildren.begin(), AddedChildren.end()); llvm::append_range(Res, AddedChildren);
return Res; return Res;
} }

View File

@ -6358,8 +6358,7 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
} }
case bitc::FS_TYPE_TESTS: case bitc::FS_TYPE_TESTS:
assert(PendingTypeTests.empty()); assert(PendingTypeTests.empty());
PendingTypeTests.insert(PendingTypeTests.end(), Record.begin(), llvm::append_range(PendingTypeTests, Record);
Record.end());
break; break;
case bitc::FS_TYPE_TEST_ASSUME_VCALLS: case bitc::FS_TYPE_TEST_ASSUME_VCALLS:

View File

@ -3629,7 +3629,7 @@ static void writeFunctionTypeMetadataRecords(BitstreamWriter &Stream,
Record.clear(); Record.clear();
Record.push_back(VC.VFunc.GUID); Record.push_back(VC.VFunc.GUID);
Record.push_back(VC.VFunc.Offset); Record.push_back(VC.VFunc.Offset);
Record.insert(Record.end(), VC.Args.begin(), VC.Args.end()); llvm::append_range(Record, VC.Args);
Stream.EmitRecord(Ty, Record); Stream.EmitRecord(Ty, Record);
} }
}; };
@ -3703,7 +3703,7 @@ static void writeWholeProgramDevirtResolutionByArg(
SmallVector<uint64_t, 64> &NameVals, const std::vector<uint64_t> &args, SmallVector<uint64_t, 64> &NameVals, const std::vector<uint64_t> &args,
const WholeProgramDevirtResolution::ByArg &ByArg) { const WholeProgramDevirtResolution::ByArg &ByArg) {
NameVals.push_back(args.size()); NameVals.push_back(args.size());
NameVals.insert(NameVals.end(), args.begin(), args.end()); llvm::append_range(NameVals, args);
NameVals.push_back(ByArg.TheKind); NameVals.push_back(ByArg.TheKind);
NameVals.push_back(ByArg.Info); NameVals.push_back(ByArg.Info);

View File

@ -27,8 +27,7 @@ Error BitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) {
if (BlockInfo) { if (BlockInfo) {
if (const BitstreamBlockInfo::BlockInfo *Info = if (const BitstreamBlockInfo::BlockInfo *Info =
BlockInfo->getBlockInfo(BlockID)) { BlockInfo->getBlockInfo(BlockID)) {
CurAbbrevs.insert(CurAbbrevs.end(), Info->Abbrevs.begin(), llvm::append_range(CurAbbrevs, Info->Abbrevs);
Info->Abbrevs.end());
} }
} }

View File

@ -1575,7 +1575,7 @@ static void insertLineSequence(std::vector<DWARFDebugLine::Row> &Seq,
return; return;
if (!Rows.empty() && Rows.back().Address < Seq.front().Address) { if (!Rows.empty() && Rows.back().Address < Seq.front().Address) {
Rows.insert(Rows.end(), Seq.begin(), Seq.end()); llvm::append_range(Rows, Seq);
Seq.clear(); Seq.clear();
return; return;
} }

View File

@ -419,7 +419,7 @@ static GenericValue lle_X_printf(FunctionType *FT,
char Buffer[10000]; char Buffer[10000];
std::vector<GenericValue> NewArgs; std::vector<GenericValue> NewArgs;
NewArgs.push_back(PTOGV((void*)&Buffer[0])); NewArgs.push_back(PTOGV((void*)&Buffer[0]));
NewArgs.insert(NewArgs.end(), Args.begin(), Args.end()); llvm::append_range(NewArgs, Args);
GenericValue GV = lle_X_sprintf(FT, NewArgs); GenericValue GV = lle_X_sprintf(FT, NewArgs);
outs() << Buffer; outs() << Buffer;
return GV; return GV;

View File

@ -1241,8 +1241,7 @@ void JITDylib::setLinkOrder(JITDylibSearchOrder NewLinkOrder,
if (NewLinkOrder.empty() || NewLinkOrder.front().first != this) if (NewLinkOrder.empty() || NewLinkOrder.front().first != this)
LinkOrder.push_back( LinkOrder.push_back(
std::make_pair(this, JITDylibLookupFlags::MatchAllSymbols)); std::make_pair(this, JITDylibLookupFlags::MatchAllSymbols));
LinkOrder.insert(LinkOrder.end(), NewLinkOrder.begin(), llvm::append_range(LinkOrder, NewLinkOrder);
NewLinkOrder.end());
} else } else
LinkOrder = std::move(NewLinkOrder); LinkOrder = std::move(NewLinkOrder);
}); });

View File

@ -1200,7 +1200,7 @@ AttributeList AttributeList::get(LLVMContext &C, AttributeSet FnAttrs,
if (NumSets > 2) { if (NumSets > 2) {
// Drop the empty argument attribute sets at the end. // Drop the empty argument attribute sets at the end.
ArgAttrs = ArgAttrs.take_front(NumSets - 2); ArgAttrs = ArgAttrs.take_front(NumSets - 2);
AttrSets.insert(AttrSets.end(), ArgAttrs.begin(), ArgAttrs.end()); llvm::append_range(AttrSets, ArgAttrs);
} }
return getImpl(C, AttrSets); return getImpl(C, AttrSets);

View File

@ -578,7 +578,7 @@ getStatepointArgs(IRBuilderBase &B, uint64_t ID, uint32_t NumPatchBytes,
Args.push_back(ActualCallee); Args.push_back(ActualCallee);
Args.push_back(B.getInt32(CallArgs.size())); Args.push_back(B.getInt32(CallArgs.size()));
Args.push_back(B.getInt32(Flags)); Args.push_back(B.getInt32(Flags));
Args.insert(Args.end(), CallArgs.begin(), CallArgs.end()); llvm::append_range(Args, CallArgs);
// GC Transition and Deopt args are now always handled via operand bundle. // GC Transition and Deopt args are now always handled via operand bundle.
// They will be removed from the signature of gc.statepoint shortly. // They will be removed from the signature of gc.statepoint shortly.
Args.push_back(B.getInt32(0)); Args.push_back(B.getInt32(0));
@ -595,18 +595,17 @@ getStatepointBundles(Optional<ArrayRef<T1>> TransitionArgs,
std::vector<OperandBundleDef> Rval; std::vector<OperandBundleDef> Rval;
if (DeoptArgs) { if (DeoptArgs) {
SmallVector<Value*, 16> DeoptValues; SmallVector<Value*, 16> DeoptValues;
DeoptValues.insert(DeoptValues.end(), DeoptArgs->begin(), DeoptArgs->end()); llvm::append_range(DeoptValues, *DeoptArgs);
Rval.emplace_back("deopt", DeoptValues); Rval.emplace_back("deopt", DeoptValues);
} }
if (TransitionArgs) { if (TransitionArgs) {
SmallVector<Value*, 16> TransitionValues; SmallVector<Value*, 16> TransitionValues;
TransitionValues.insert(TransitionValues.end(), llvm::append_range(TransitionValues, *TransitionArgs);
TransitionArgs->begin(), TransitionArgs->end());
Rval.emplace_back("gc-transition", TransitionValues); Rval.emplace_back("gc-transition", TransitionValues);
} }
if (GCArgs.size()) { if (GCArgs.size()) {
SmallVector<Value*, 16> LiveValues; SmallVector<Value*, 16> LiveValues;
LiveValues.insert(LiveValues.end(), GCArgs.begin(), GCArgs.end()); llvm::append_range(LiveValues, GCArgs);
Rval.emplace_back("gc-live", LiveValues); Rval.emplace_back("gc-live", LiveValues);
} }
return Rval; return Rval;

View File

@ -5975,7 +5975,7 @@ bool AsmParser::parseMSInlineAsm(
// Consider implicit defs to be clobbers. Think of cpuid and push. // Consider implicit defs to be clobbers. Think of cpuid and push.
ArrayRef<MCPhysReg> ImpDefs(Desc.getImplicitDefs(), ArrayRef<MCPhysReg> ImpDefs(Desc.getImplicitDefs(),
Desc.getNumImplicitDefs()); Desc.getNumImplicitDefs());
ClobberRegs.insert(ClobberRegs.end(), ImpDefs.begin(), ImpDefs.end()); llvm::append_range(ClobberRegs, ImpDefs);
} }
// Set the number of Outputs and Inputs. // Set the number of Outputs and Inputs.

View File

@ -4044,8 +4044,7 @@ bool MasmParser::parseStructInstList(
return true; return true;
for (int i = 0; i < Repetitions; ++i) for (int i = 0; i < Repetitions; ++i)
Initializers.insert(Initializers.end(), DuplicatedValues.begin(), llvm::append_range(Initializers, DuplicatedValues);
DuplicatedValues.end());
} else { } else {
Initializers.emplace_back(); Initializers.emplace_back();
if (parseStructInitializer(Structure, Initializers.back())) if (parseStructInitializer(Structure, Initializers.back()))
@ -7119,7 +7118,7 @@ bool MasmParser::parseMSInlineAsm(
// Consider implicit defs to be clobbers. Think of cpuid and push. // Consider implicit defs to be clobbers. Think of cpuid and push.
ArrayRef<MCPhysReg> ImpDefs(Desc.getImplicitDefs(), ArrayRef<MCPhysReg> ImpDefs(Desc.getImplicitDefs(),
Desc.getNumImplicitDefs()); Desc.getNumImplicitDefs());
ClobberRegs.insert(ClobberRegs.end(), ImpDefs.begin(), ImpDefs.end()); llvm::append_range(ClobberRegs, ImpDefs);
} }
// Set the number of Outputs and Inputs. // Set the number of Outputs and Inputs.

View File

@ -649,11 +649,11 @@ static void addData(SmallVectorImpl<char> &DataBytes,
Fill->getValue()); Fill->getValue());
} else if (auto *LEB = dyn_cast<MCLEBFragment>(&Frag)) { } else if (auto *LEB = dyn_cast<MCLEBFragment>(&Frag)) {
const SmallVectorImpl<char> &Contents = LEB->getContents(); const SmallVectorImpl<char> &Contents = LEB->getContents();
DataBytes.insert(DataBytes.end(), Contents.begin(), Contents.end()); llvm::append_range(DataBytes, Contents);
} else { } else {
const auto &DataFrag = cast<MCDataFragment>(Frag); const auto &DataFrag = cast<MCDataFragment>(Frag);
const SmallVectorImpl<char> &Contents = DataFrag.getContents(); const SmallVectorImpl<char> &Contents = DataFrag.getContents();
DataBytes.insert(DataBytes.end(), Contents.begin(), Contents.end()); llvm::append_range(DataBytes, Contents);
} }
} }

View File

@ -241,7 +241,7 @@ void Scheduler::updateIssuedSet(SmallVectorImpl<InstRef> &Executed) {
} }
uint64_t Scheduler::analyzeResourcePressure(SmallVectorImpl<InstRef> &Insts) { uint64_t Scheduler::analyzeResourcePressure(SmallVectorImpl<InstRef> &Insts) {
Insts.insert(Insts.end(), ReadySet.begin(), ReadySet.end()); llvm::append_range(Insts, ReadySet);
return BusyResourceUnits; return BusyResourceUnits;
} }

View File

@ -616,8 +616,7 @@ public:
std::vector<StringRef> CoverageMapping::getUniqueSourceFiles() const { std::vector<StringRef> CoverageMapping::getUniqueSourceFiles() const {
std::vector<StringRef> Filenames; std::vector<StringRef> Filenames;
for (const auto &Function : getCoveredFunctions()) for (const auto &Function : getCoveredFunctions())
Filenames.insert(Filenames.end(), Function.Filenames.begin(), llvm::append_range(Filenames, Function.Filenames);
Function.Filenames.end());
llvm::sort(Filenames); llvm::sort(Filenames);
auto Last = std::unique(Filenames.begin(), Filenames.end()); auto Last = std::unique(Filenames.begin(), Filenames.end());
Filenames.erase(Last, Filenames.end()); Filenames.erase(Last, Filenames.end());

View File

@ -1349,7 +1349,7 @@ std::error_code SampleProfileReaderGCC::readOneFunctionProfile(
InlineCallStack NewStack; InlineCallStack NewStack;
NewStack.push_back(FProfile); NewStack.push_back(FProfile);
NewStack.insert(NewStack.end(), InlineStack.begin(), InlineStack.end()); llvm::append_range(NewStack, InlineStack);
if (Update) { if (Update) {
// Walk up the inline stack, adding the samples on this line to // Walk up the inline stack, adding the samples on this line to
// the total sample count of the callers in the chain. // the total sample count of the callers in the chain.
@ -1397,7 +1397,7 @@ std::error_code SampleProfileReaderGCC::readOneFunctionProfile(
return sampleprof_error::truncated; return sampleprof_error::truncated;
InlineCallStack NewStack; InlineCallStack NewStack;
NewStack.push_back(FProfile); NewStack.push_back(FProfile);
NewStack.insert(NewStack.end(), InlineStack.begin(), InlineStack.end()); llvm::append_range(NewStack, InlineStack);
if (std::error_code EC = readOneFunctionProfile(NewStack, Update, Offset)) if (std::error_code EC = readOneFunctionProfile(NewStack, Update, Offset))
return EC; return EC;
} }

View File

@ -212,7 +212,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program,
return false; return false;
} }
EnvBlock.insert(EnvBlock.end(), EnvString.begin(), EnvString.end()); llvm::append_range(EnvBlock, EnvString);
EnvBlock.push_back(0); EnvBlock.push_back(0);
} }
EnvBlock.push_back(0); EnvBlock.push_back(0);

View File

@ -715,7 +715,7 @@ std::string yaml::escape(StringRef Input, bool EscapePrintable) {
// Found invalid char. // Found invalid char.
SmallString<4> Val; SmallString<4> Val;
encodeUTF8(0xFFFD, Val); encodeUTF8(0xFFFD, Val);
EscapedInput.insert(EscapedInput.end(), Val.begin(), Val.end()); llvm::append_range(EscapedInput, Val);
// FIXME: Error reporting. // FIXME: Error reporting.
return EscapedInput; return EscapedInput;
} }
@ -1984,11 +1984,11 @@ StringRef ScalarNode::getValue(SmallVectorImpl<char> &Storage) const {
Storage.reserve(UnquotedValue.size()); Storage.reserve(UnquotedValue.size());
for (; i != StringRef::npos; i = UnquotedValue.find('\'')) { for (; i != StringRef::npos; i = UnquotedValue.find('\'')) {
StringRef Valid(UnquotedValue.begin(), i); StringRef Valid(UnquotedValue.begin(), i);
Storage.insert(Storage.end(), Valid.begin(), Valid.end()); llvm::append_range(Storage, Valid);
Storage.push_back('\''); Storage.push_back('\'');
UnquotedValue = UnquotedValue.substr(i + 2); UnquotedValue = UnquotedValue.substr(i + 2);
} }
Storage.insert(Storage.end(), UnquotedValue.begin(), UnquotedValue.end()); llvm::append_range(Storage, UnquotedValue);
return StringRef(Storage.begin(), Storage.size()); return StringRef(Storage.begin(), Storage.size());
} }
return UnquotedValue; return UnquotedValue;
@ -2007,7 +2007,7 @@ StringRef ScalarNode::unescapeDoubleQuoted( StringRef UnquotedValue
for (; i != StringRef::npos; i = UnquotedValue.find_first_of("\\\r\n")) { for (; i != StringRef::npos; i = UnquotedValue.find_first_of("\\\r\n")) {
// Insert all previous chars into Storage. // Insert all previous chars into Storage.
StringRef Valid(UnquotedValue.begin(), i); StringRef Valid(UnquotedValue.begin(), i);
Storage.insert(Storage.end(), Valid.begin(), Valid.end()); llvm::append_range(Storage, Valid);
// Chop off inserted chars. // Chop off inserted chars.
UnquotedValue = UnquotedValue.substr(i); UnquotedValue = UnquotedValue.substr(i);
@ -2139,7 +2139,7 @@ StringRef ScalarNode::unescapeDoubleQuoted( StringRef UnquotedValue
UnquotedValue = UnquotedValue.substr(1); UnquotedValue = UnquotedValue.substr(1);
} }
} }
Storage.insert(Storage.end(), UnquotedValue.begin(), UnquotedValue.end()); llvm::append_range(Storage, UnquotedValue);
return StringRef(Storage.begin(), Storage.size()); return StringRef(Storage.begin(), Storage.size());
} }

View File

@ -905,8 +905,8 @@ Init *BinOpInit::getStrConcat(Init *I0, Init *I1) {
static ListInit *ConcatListInits(const ListInit *LHS, static ListInit *ConcatListInits(const ListInit *LHS,
const ListInit *RHS) { const ListInit *RHS) {
SmallVector<Init *, 8> Args; SmallVector<Init *, 8> Args;
Args.insert(Args.end(), LHS->begin(), LHS->end()); llvm::append_range(Args, *LHS);
Args.insert(Args.end(), RHS->begin(), RHS->end()); llvm::append_range(Args, *RHS);
return ListInit::get(Args, LHS->getElementType()); return ListInit::get(Args, LHS->getElementType());
} }
@ -959,8 +959,8 @@ Init *BinOpInit::Fold(Record *CurRec) const {
ListInit *RHSs = dyn_cast<ListInit>(RHS); ListInit *RHSs = dyn_cast<ListInit>(RHS);
if (LHSs && RHSs) { if (LHSs && RHSs) {
SmallVector<Init *, 8> Args; SmallVector<Init *, 8> Args;
Args.insert(Args.end(), LHSs->begin(), LHSs->end()); llvm::append_range(Args, *LHSs);
Args.insert(Args.end(), RHSs->begin(), RHSs->end()); llvm::append_range(Args, *RHSs);
return ListInit::get(Args, LHSs->getElementType()); return ListInit::get(Args, LHSs->getElementType());
} }
break; break;