[llvm] r238602 - Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial types
David Blaikie
dblaikie at gmail.com
Fri May 29 12:58:23 PDT 2015
On Fri, May 29, 2015 at 12:43 PM, Benjamin Kramer <benny.kra at googlemail.com>
wrote:
> Author: d0k
> Date: Fri May 29 14:43:39 2015
> New Revision: 238602
>
> URL: http://llvm.org/viewvc/llvm-project?rev=238602&view=rev
> Log:
> Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial
> types
>
Totally open to discussion - but I kind of prefer the former than the
latter except where I need the object to not move around (eg: because I
need pointer identity during the ctor, etc). If the type's cheaply movable,
even if not trivially so, I usually avoid emplace.
- David
>
> If the type isn't trivially moveable emplace can skip a potentially
> expensive move. It also saves a couple of characters.
>
>
> Call sites were found with the ASTMatcher + some semi-automated cleanup.
>
> memberCallExpr(
> argumentCountIs(1), callee(methodDecl(hasName("push_back"))),
> on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))),
> hasArgument(0, bindTemporaryExpr(
> hasType(recordDecl(hasNonTrivialDestructor())),
> has(constructExpr()))),
> unless(isInTemplateInstantiation()))
>
> No functional change intended.
>
> Modified:
> llvm/trunk/include/llvm/Analysis/CallGraph.h
> llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
> llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
> llvm/trunk/include/llvm/CodeGen/GCMetadata.h
> llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h
> llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
> llvm/trunk/lib/Analysis/AliasSetTracker.cpp
> llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
> llvm/trunk/lib/AsmParser/LLParser.cpp
> llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
> llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
> llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
> llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
> llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp
> llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp
> llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> llvm/trunk/lib/TableGen/TGParser.cpp
> llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp
> llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
> llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
> llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
> llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
> llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
> llvm/trunk/lib/Transforms/Utils/SimplifyIndVar.cpp
> llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
> llvm/trunk/tools/bugpoint/CrashDebugger.cpp
> llvm/trunk/tools/bugpoint/Miscompilation.cpp
> llvm/trunk/tools/lli/OrcLazyJIT.h
> llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
> llvm/trunk/tools/llvm-pdbdump/LinePrinter.h
> llvm/trunk/utils/FileCheck/FileCheck.cpp
> llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
> llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
> llvm/trunk/utils/TableGen/AsmWriterInst.cpp
> llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
> llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
> llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
> llvm/trunk/utils/TableGen/CodeGenSchedule.cpp
> llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
> llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
>
> Modified: llvm/trunk/include/llvm/Analysis/CallGraph.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/CallGraph.h?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/CallGraph.h (original)
> +++ llvm/trunk/include/llvm/Analysis/CallGraph.h Fri May 29 14:43:39 2015
> @@ -230,7 +230,7 @@ public:
> void addCalledFunction(CallSite CS, CallGraphNode *M) {
> assert(!CS.getInstruction() || !CS.getCalledFunction() ||
> !CS.getCalledFunction()->isIntrinsic());
> - CalledFunctions.push_back(std::make_pair(CS.getInstruction(), M));
> + CalledFunctions.emplace_back(CS.getInstruction(), M);
> M->AddRef();
> }
>
>
> Modified: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamReader.h?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h (original)
> +++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Fri May 29 14:43:39
> 2015
> @@ -113,7 +113,7 @@ public:
> return *const_cast<BlockInfo*>(BI);
>
> // Otherwise, add a new record.
> - BlockInfoRecords.push_back(BlockInfo());
> + BlockInfoRecords.emplace_back();
> BlockInfoRecords.back().BlockID = BlockID;
> return BlockInfoRecords.back();
> }
>
> Modified: llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h (original)
> +++ llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h Fri May 29 14:43:39
> 2015
> @@ -215,7 +215,7 @@ public:
>
> // Push the outer block's abbrev set onto the stack, start out with an
> // empty abbrev set.
> - BlockScope.push_back(Block(OldCodeSize, BlockSizeWordIndex));
> + BlockScope.emplace_back(OldCodeSize, BlockSizeWordIndex);
> BlockScope.back().PrevAbbrevs.swap(CurAbbrevs);
>
> // If there is a blockinfo for this BlockID, add all the predefined
> abbrevs
> @@ -503,7 +503,7 @@ private:
> return *BI;
>
> // Otherwise, add a new record.
> - BlockInfoRecords.push_back(BlockInfo());
> + BlockInfoRecords.emplace_back();
> BlockInfoRecords.back().BlockID = BlockID;
> return BlockInfoRecords.back();
> }
>
> Modified: llvm/trunk/include/llvm/CodeGen/GCMetadata.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GCMetadata.h?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/GCMetadata.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/GCMetadata.h Fri May 29 14:43:39 2015
> @@ -121,7 +121,7 @@ public:
> /// label just prior to the safe point (if the code generator is using
> /// MachineModuleInfo).
> void addSafePoint(GC::PointKind Kind, MCSymbol *Label, DebugLoc DL) {
> - SafePoints.push_back(GCPoint(Kind, Label, DL));
> + SafePoints.emplace_back(Kind, Label, DL);
> }
>
> /// getFrameSize/setFrameSize - Records the function's frame size.
>
> Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAGInstrs.h Fri May 29
> 14:43:39 2015
> @@ -260,7 +260,7 @@ namespace llvm {
> #ifndef NDEBUG
> const SUnit *Addr = SUnits.empty() ? nullptr : &SUnits[0];
> #endif
> - SUnits.push_back(SUnit(MI, (unsigned)SUnits.size()));
> + SUnits.emplace_back(MI, (unsigned)SUnits.size());
> assert((Addr == nullptr || Addr == &SUnits[0]) &&
> "SUnits std::vector reallocated on the fly!");
> SUnits.back().OrigNode = &SUnits.back();
>
> Modified:
> llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
> (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h Fri
> May 29 14:43:39 2015
> @@ -390,8 +390,7 @@ public:
> for (auto &F : *M) {
> if (F.isDeclaration())
> continue;
> - Partitioning.push_back(std::vector<Function*>());
> - Partitioning.back().push_back(&F);
> + Partitioning.emplace_back(1, &F);
> }
> addLogicalModule(*LogicalDylibs.back(),
> std::shared_ptr<Module>(std::move(M)),
>
> Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original)
> +++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Fri May 29 14:43:39 2015
> @@ -130,7 +130,7 @@ void AliasSet::addPointer(AliasSetTracke
> void AliasSet::addUnknownInst(Instruction *I, AliasAnalysis &AA) {
> if (UnknownInsts.empty())
> addRef();
> - UnknownInsts.push_back(I);
> + UnknownInsts.emplace_back(I);
>
> if (!I->mayWriteToMemory()) {
> AliasTy = MayAlias;
>
> Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original)
> +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Fri May 29
> 14:43:39 2015
> @@ -1712,7 +1712,7 @@ unsigned SCEVExpander::replaceCongruentI
> // would confuse the logic below that expects proper IVs.
> if (Value *V = SimplifyInstruction(Phi, DL, SE.TLI, SE.DT, SE.AC)) {
> Phi->replaceAllUsesWith(V);
> - DeadInsts.push_back(Phi);
> + DeadInsts.emplace_back(Phi);
> ++NumElim;
> DEBUG_WITH_TYPE(DebugType, dbgs()
> << "INDVARS: Eliminated constant iv: " << *Phi <<
> '\n');
> @@ -1787,7 +1787,7 @@ unsigned SCEVExpander::replaceCongruentI
> CreateTruncOrBitCast(OrigInc, IsomorphicInc->getType(),
> IVName);
> }
> IsomorphicInc->replaceAllUsesWith(NewInc);
> - DeadInsts.push_back(IsomorphicInc);
> + DeadInsts.emplace_back(IsomorphicInc);
> }
> }
> DEBUG_WITH_TYPE(DebugType, dbgs()
> @@ -1800,7 +1800,7 @@ unsigned SCEVExpander::replaceCongruentI
> NewIV = Builder.CreateTruncOrBitCast(OrigPhiRef, Phi->getType(),
> IVName);
> }
> Phi->replaceAllUsesWith(NewIV);
> - DeadInsts.push_back(Phi);
> + DeadInsts.emplace_back(Phi);
> }
> return NumElim;
> }
>
> Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
> +++ llvm/trunk/lib/AsmParser/LLParser.cpp Fri May 29 14:43:39 2015
> @@ -1902,9 +1902,9 @@ bool LLParser::ParseArgumentList(SmallVe
> return Error(TypeLoc, "invalid type for function argument");
>
> unsigned AttrIndex = 1;
> - ArgList.push_back(ArgInfo(TypeLoc, ArgTy,
> - AttributeSet::get(ArgTy->getContext(),
> - AttrIndex++, Attrs),
> Name));
> + ArgList.emplace_back(TypeLoc, ArgTy,
> AttributeSet::get(ArgTy->getContext(),
> + AttrIndex++,
> Attrs),
> + std::move(Name));
>
> while (EatIfPresent(lltok::comma)) {
> // Handle ... at end of arg list.
> @@ -1930,10 +1930,10 @@ bool LLParser::ParseArgumentList(SmallVe
> if (!ArgTy->isFirstClassType())
> return Error(TypeLoc, "invalid type for function argument");
>
> - ArgList.push_back(ArgInfo(TypeLoc, ArgTy,
> - AttributeSet::get(ArgTy->getContext(),
> - AttrIndex++, Attrs),
> - Name));
> + ArgList.emplace_back(
> + TypeLoc, ArgTy,
> + AttributeSet::get(ArgTy->getContext(), AttrIndex++, Attrs),
> + std::move(Name));
> }
> }
>
>
> Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
> +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri May 29 14:43:39
> 2015
> @@ -63,9 +63,7 @@ public:
> // vector compatibility methods
> unsigned size() const { return ValuePtrs.size(); }
> void resize(unsigned N) { ValuePtrs.resize(N); }
> - void push_back(Value *V) {
> - ValuePtrs.push_back(V);
> - }
> + void push_back(Value *V) { ValuePtrs.emplace_back(V); }
>
> void clear() {
> assert(ResolveConstants.empty() && "Constants not resolved?");
>
> Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Fri May 29 14:43:39 2015
> @@ -114,7 +114,7 @@ MCSymbol *MMIAddrLabelMap::getAddrLabelS
>
> // Otherwise, this is a new entry, create a new symbol for it and add an
> // entry to BBCallbacks so we can be notified if the BB is deleted or
> RAUWd.
> - BBCallbacks.push_back(BB);
> + BBCallbacks.emplace_back(BB);
> BBCallbacks.back().setMap(this);
> Entry.Index = BBCallbacks.size()-1;
> Entry.Fn = BB->getParent();
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp Fri May 29
> 14:43:39 2015
> @@ -71,7 +71,7 @@ SUnit *ScheduleDAGSDNodes::newSUnit(SDNo
> if (!SUnits.empty())
> Addr = &SUnits[0];
> #endif
> - SUnits.push_back(SUnit(N, (unsigned)SUnits.size()));
> + SUnits.emplace_back(N, (unsigned)SUnits.size());
> assert((Addr == nullptr || Addr == &SUnits[0]) &&
> "SUnits std::vector reallocated on the fly!");
> SUnits.back().OrigNode = &SUnits.back();
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Fri May 29
> 14:43:39 2015
> @@ -7437,7 +7437,7 @@ bool SelectionDAGBuilder::buildJumpTable
> JumpTableHeader JTH(Clusters[First].Low->getValue(),
> Clusters[Last].High->getValue(), SI->getCondition(),
> nullptr, false);
> - JTCases.push_back(JumpTableBlock(JTH, JT));
> + JTCases.emplace_back(std::move(JTH), std::move(JT));
>
> JTCluster = CaseCluster::jumpTable(Clusters[First].Low,
> Clusters[Last].High,
> JTCases.size() - 1, Weight);
> @@ -7650,9 +7650,9 @@ bool SelectionDAGBuilder::buildBitTests(
> FuncInfo.MF->CreateMachineBasicBlock(SI->getParent());
> BTI.push_back(BitTestCase(CB.Mask, BitTestBB, CB.BB,
> CB.ExtraWeight));
> }
> - BitTestCases.push_back(BitTestBlock(LowBound, CmpRange,
> SI->getCondition(),
> - -1U, MVT::Other, false, nullptr,
> - nullptr, std::move(BTI)));
> + BitTestCases.emplace_back(std::move(LowBound), std::move(CmpRange),
> + SI->getCondition(), -1U, MVT::Other, false,
> nullptr,
> + nullptr, std::move(BTI));
>
> BTCluster = CaseCluster::bitTests(Clusters[First].Low,
> Clusters[Last].High,
> BitTestCases.size() - 1, TotalWeight);
>
> Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp (original)
> +++ llvm/trunk/lib/DebugInfo/DWARF/DWARFContext.cpp Fri May 29 14:43:39
> 2015
> @@ -352,7 +352,7 @@ void DWARFContext::parseTypeUnits() {
> if (!TUs.empty())
> return;
> for (const auto &I : getTypesSections()) {
> - TUs.push_back(DWARFUnitSection<DWARFTypeUnit>());
> + TUs.emplace_back();
> TUs.back().parse(*this, I.second);
> }
> }
> @@ -365,7 +365,7 @@ void DWARFContext::parseDWOTypeUnits() {
> if (!DWOTUs.empty())
> return;
> for (const auto &I : getTypesDWOSections()) {
> - DWOTUs.push_back(DWARFUnitSection<DWARFTypeUnit>());
> + DWOTUs.emplace_back();
> DWOTUs.back().parseDWO(*this, I.second);
> }
> }
>
> Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Fri May 29 14:43:39
> 2015
> @@ -438,7 +438,7 @@ int ExecutionEngine::runFunctionAsMain(F
> if (NumArgs > 2) {
> std::vector<std::string> EnvVars;
> for (unsigned i = 0; envp[i]; ++i)
> - EnvVars.push_back(envp[i]);
> + EnvVars.emplace_back(envp[i]);
> // Arg #2 = envp.
> GVArgs.push_back(PTOGV(CEnv.reset(Fn->getContext(), this,
> EnvVars)));
> }
>
> Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngineBindings.cpp Fri May 29
> 14:43:39 2015
> @@ -254,11 +254,8 @@ int LLVMRunFunctionAsMain(LLVMExecutionE
> unsigned ArgC, const char * const *ArgV,
> const char * const *EnvP) {
> unwrap(EE)->finalizeObject();
> -
> - std::vector<std::string> ArgVec;
> - for (unsigned I = 0; I != ArgC; ++I)
> - ArgVec.push_back(ArgV[I]);
> -
> +
> + std::vector<std::string> ArgVec(ArgV, ArgV + ArgC);
> return unwrap(EE)->runFunctionAsMain(unwrap<Function>(F), ArgVec, EnvP);
> }
>
>
> Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp Fri May 29
> 14:43:39 2015
> @@ -2079,7 +2079,7 @@ void Interpreter::callFunction(Function
> ECStack.back().Caller.arg_size() == ArgVals.size()) &&
> "Incorrect number of arguments passed into function call!");
> // Make a new stack frame... and fill it in.
> - ECStack.push_back(ExecutionContext());
> + ECStack.emplace_back();
> ExecutionContext &StackFrame = ECStack.back();
> StackFrame.CurFunction = F;
>
>
> Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
> +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Fri May 29 14:43:39 2015
> @@ -1949,7 +1949,7 @@ bool AsmParser::parseMacroArgument(MCAsm
> if (Vararg) {
> if (Lexer.isNot(AsmToken::EndOfStatement)) {
> StringRef Str = parseStringToEndOfStatement();
> - MA.push_back(AsmToken(AsmToken::String, Str));
> + MA.emplace_back(AsmToken::String, Str);
> }
> return false;
> }
> @@ -4346,8 +4346,7 @@ MCAsmMacro *AsmParser::parseMacroLikeBod
> StringRef Body = StringRef(BodyStart, BodyEnd - BodyStart);
>
> // We Are Anonymous.
> - MacroLikeBodies.push_back(
> - MCAsmMacro(StringRef(), Body, MCAsmMacroParameters()));
> + MacroLikeBodies.emplace_back(StringRef(), Body, MCAsmMacroParameters());
> return &MacroLikeBodies.back();
> }
>
> @@ -4490,7 +4489,7 @@ bool AsmParser::parseDirectiveIrpc(SMLoc
> StringRef Values = A.front().front().getString();
> for (std::size_t I = 0, End = Values.size(); I != End; ++I) {
> MCAsmMacroArgument Arg;
> - Arg.push_back(AsmToken(AsmToken::Identifier, Values.slice(I, I + 1)));
> + Arg.emplace_back(AsmToken::Identifier, Values.slice(I, I + 1));
>
> // Note that the AtPseudoVariable is enabled for instantiations of
> .irpc.
> // This is undocumented, but GAS seems to support it.
>
> Modified: llvm/trunk/lib/TableGen/TGParser.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/TableGen/TGParser.cpp (original)
> +++ llvm/trunk/lib/TableGen/TGParser.cpp Fri May 29 14:43:39 2015
> @@ -1601,7 +1601,7 @@ TGParser::ParseDagArgList(Record *CurRec
> // DagArg ::= VARNAME
> if (Lex.getCode() == tgtok::VarName) {
> // A missing value is treated like '?'.
> - Result.push_back(std::make_pair(UnsetInit::get(),
> Lex.getCurStrVal()));
> + Result.emplace_back(UnsetInit::get(), Lex.getCurStrVal());
> Lex.Lex();
> } else {
> // DagArg ::= Value (':' VARNAME)?
> @@ -2174,7 +2174,7 @@ std::vector<LetRecord> TGParser::ParseLe
> if (!Val) return std::vector<LetRecord>();
>
> // Now that we have everything, add the record.
> - Result.push_back(LetRecord(Name, Bits, Val, NameLoc));
> + Result.emplace_back(std::move(Name), std::move(Bits), Val, NameLoc);
>
> if (Lex.getCode() != tgtok::comma)
> return Result;
>
> Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original)
> +++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Fri May 29 14:43:39
> 2015
> @@ -1465,7 +1465,7 @@ void MergeFunctions::remove(Function *F)
> if (Erased) {
> DEBUG(dbgs() << "Removed " << F->getName()
> << " from set and deferred it.\n");
> - Deferred.push_back(F);
> + Deferred.emplace_back(F);
> }
> }
>
>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Fri May
> 29 14:43:39 2015
> @@ -1843,7 +1843,7 @@ isAllocSiteRemovable(Instruction *AI, Sm
>
> case Instruction::BitCast:
> case Instruction::GetElementPtr:
> - Users.push_back(I);
> + Users.emplace_back(I);
> Worklist.push_back(I);
> continue;
>
> @@ -1852,7 +1852,7 @@ isAllocSiteRemovable(Instruction *AI, Sm
> // We can fold eq/ne comparisons with null to false/true,
> respectively.
> if (!ICI->isEquality() ||
> !isa<ConstantPointerNull>(ICI->getOperand(1)))
> return false;
> - Users.push_back(I);
> + Users.emplace_back(I);
> continue;
> }
>
> @@ -1878,13 +1878,13 @@ isAllocSiteRemovable(Instruction *AI, Sm
> case Intrinsic::lifetime_start:
> case Intrinsic::lifetime_end:
> case Intrinsic::objectsize:
> - Users.push_back(I);
> + Users.emplace_back(I);
> continue;
> }
> }
>
> if (isFreeCall(I, TLI)) {
> - Users.push_back(I);
> + Users.emplace_back(I);
> continue;
> }
> return false;
> @@ -1893,7 +1893,7 @@ isAllocSiteRemovable(Instruction *AI, Sm
> StoreInst *SI = cast<StoreInst>(I);
> if (SI->isVolatile() || SI->getPointerOperand() != PI)
> return false;
> - Users.push_back(I);
> + Users.emplace_back(I);
> continue;
> }
> }
>
> Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Fri May 29
> 14:43:39 2015
> @@ -1102,7 +1102,7 @@ Instruction *WidenIV::WidenIVUse(NarrowI
> IRBuilder<> Builder(WidePhi->getParent()->getFirstInsertionPt());
> Value *Trunc = Builder.CreateTrunc(WidePhi,
> DU.NarrowDef->getType());
> UsePhi->replaceAllUsesWith(Trunc);
> - DeadInsts.push_back(UsePhi);
> + DeadInsts.emplace_back(UsePhi);
> DEBUG(dbgs() << "INDVARS: Widen lcssa phi " << *UsePhi
> << " to " << *WidePhi << "\n");
> }
> @@ -1135,7 +1135,7 @@ Instruction *WidenIV::WidenIVUse(NarrowI
> << " replaced by " << *DU.WideDef << "\n");
> ++NumElimExt;
> DU.NarrowUse->replaceAllUsesWith(NewDef);
> - DeadInsts.push_back(DU.NarrowUse);
> + DeadInsts.emplace_back(DU.NarrowUse);
> }
> // Now that the extend is gone, we want to expose it's uses for
> potential
> // further simplification. We don't need to directly inform
> SimplifyIVUsers
> @@ -1188,7 +1188,7 @@ Instruction *WidenIV::WidenIVUse(NarrowI
> if (WideAddRec != SE->getSCEV(WideUse)) {
> DEBUG(dbgs() << "Wide use expression mismatch: " << *WideUse
> << ": " << *SE->getSCEV(WideUse) << " != " << *WideAddRec <<
> "\n");
> - DeadInsts.push_back(WideUse);
> + DeadInsts.emplace_back(WideUse);
> return nullptr;
> }
>
> @@ -1285,7 +1285,7 @@ PHINode *WidenIV::CreateWideIV(SCEVExpan
>
> // WidenIVUse may have removed the def-use edge.
> if (DU.NarrowDef->use_empty())
> - DeadInsts.push_back(DU.NarrowDef);
> + DeadInsts.emplace_back(DU.NarrowDef);
> }
> return WidePhi;
> }
>
> Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Fri May 29
> 14:43:39 2015
> @@ -811,7 +811,7 @@ DeleteTriviallyDeadInstructions(SmallVec
> if (Instruction *U = dyn_cast<Instruction>(O)) {
> O = nullptr;
> if (U->use_empty())
> - DeadInsts.push_back(U);
> + DeadInsts.emplace_back(U);
> }
>
> I->eraseFromParent();
> @@ -2917,7 +2917,7 @@ void LSRInstance::GenerateIVChain(const
> IVOper = Builder.CreateTruncOrBitCast(IVOper, OperTy, "lsr.chain");
> }
> Inc.UserInst->replaceUsesOfWith(Inc.IVOperand, IVOper);
> - DeadInsts.push_back(Inc.IVOperand);
> + DeadInsts.emplace_back(Inc.IVOperand);
> }
> // If LSR created a new, wider phi, we may also replace its postinc. We
> only
> // do this if we also found a wide value for the head of the chain.
> @@ -2939,7 +2939,7 @@ void LSRInstance::GenerateIVChain(const
> IVOper = Builder.CreatePointerCast(IVSrc, PostIncTy, "lsr.chain");
> }
> Phi->replaceUsesOfWith(PostIncV, IVOper);
> - DeadInsts.push_back(PostIncV);
> + DeadInsts.emplace_back(PostIncV);
> }
> }
> }
> @@ -4594,7 +4594,7 @@ Value *LSRInstance::Expand(const LSRFixu
> // form, update the ICmp's other operand.
> if (LU.Kind == LSRUse::ICmpZero) {
> ICmpInst *CI = cast<ICmpInst>(LF.UserInst);
> - DeadInsts.push_back(CI->getOperand(1));
> + DeadInsts.emplace_back(CI->getOperand(1));
> assert(!F.BaseGV && "ICmp does not support folding a global value and
> "
> "a scale at the same time!");
> if (F.Scale == -1) {
> @@ -4737,7 +4737,7 @@ void LSRInstance::Rewrite(const LSRFixup
> LF.UserInst->replaceUsesOfWith(LF.OperandValToReplace, FullV);
> }
>
> - DeadInsts.push_back(LF.OperandValToReplace);
> + DeadInsts.emplace_back(LF.OperandValToReplace);
> }
>
> /// ImplementSolution - Rewrite all the fixup locations with new values,
>
> Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Fri May 29 14:43:39
> 2015
> @@ -733,7 +733,7 @@ static bool LinearizeExprTree(BinaryOper
> if (Ops.empty()) {
> Constant *Identity = ConstantExpr::getBinOpIdentity(Opcode,
> I->getType());
> assert(Identity && "Associative operation without identity!");
> - Ops.push_back(std::make_pair(Identity, APInt(Bitwidth, 1)));
> + Ops.emplace_back(Identity, APInt(Bitwidth, 1));
> }
>
> return Changed;
>
> Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Fri May 29
> 14:43:39 2015
> @@ -636,7 +636,7 @@ void PromoteMem2Reg::run() {
> // and inserting the phi nodes we marked as necessary
> //
> std::vector<RenamePassData> RenamePassWorkList;
> - RenamePassWorkList.push_back(RenamePassData(F.begin(), nullptr,
> Values));
> + RenamePassWorkList.emplace_back(F.begin(), nullptr, std::move(Values));
> do {
> RenamePassData RPD;
> RPD.swap(RenamePassWorkList.back());
> @@ -973,7 +973,7 @@ NextIteration:
>
> for (; I != E; ++I)
> if (VisitedSuccs.insert(*I).second)
> - Worklist.push_back(RenamePassData(*I, Pred, IncomingVals));
> + Worklist.emplace_back(*I, Pred, IncomingVals);
>
> goto NextIteration;
> }
>
> Modified: llvm/trunk/lib/Transforms/Utils/SimplifyIndVar.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyIndVar.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Utils/SimplifyIndVar.cpp (original)
> +++ llvm/trunk/lib/Transforms/Utils/SimplifyIndVar.cpp Fri May 29 14:43:39
> 2015
> @@ -141,7 +141,7 @@ Value *SimplifyIndvar::foldIVUser(Instru
> ++NumElimOperand;
> Changed = true;
> if (IVOperand->use_empty())
> - DeadInsts.push_back(IVOperand);
> + DeadInsts.emplace_back(IVOperand);
> return IVSrc;
> }
>
> @@ -178,7 +178,7 @@ void SimplifyIndvar::eliminateIVComparis
> DEBUG(dbgs() << "INDVARS: Eliminated comparison: " << *ICmp << '\n');
> ++NumElimCmp;
> Changed = true;
> - DeadInsts.push_back(ICmp);
> + DeadInsts.emplace_back(ICmp);
> }
>
> /// SimplifyIVUsers helper for eliminating useless
> @@ -229,7 +229,7 @@ void SimplifyIndvar::eliminateIVRemainde
> DEBUG(dbgs() << "INDVARS: Simplified rem: " << *Rem << '\n');
> ++NumElimRem;
> Changed = true;
> - DeadInsts.push_back(Rem);
> + DeadInsts.emplace_back(Rem);
> }
>
> /// Eliminate an operation that consumes a simple IV and has
> @@ -260,7 +260,7 @@ bool SimplifyIndvar::eliminateIVUser(Ins
> UseInst->replaceAllUsesWith(IVOperand);
> ++NumElimIdentity;
> Changed = true;
> - DeadInsts.push_back(UseInst);
> + DeadInsts.emplace_back(UseInst);
> return true;
> }
>
> @@ -386,7 +386,7 @@ Instruction *SimplifyIndvar::splitOverfl
> "Bad add instruction created from overflow intrinsic.");
>
> AddVal->replaceAllUsesWith(AddInst);
> - DeadInsts.push_back(AddVal);
> + DeadInsts.emplace_back(AddVal);
> return AddInst;
> }
>
>
> Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
> +++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Fri May 29
> 14:43:39 2015
> @@ -472,7 +472,7 @@ private:
>
> /// Create a new VectorizableTree entry.
> TreeEntry *newTreeEntry(ArrayRef<Value *> VL, bool Vectorized) {
> - VectorizableTree.push_back(TreeEntry());
> + VectorizableTree.emplace_back();
> int idx = VectorizableTree.size() - 1;
> TreeEntry *Last = &VectorizableTree[idx];
> Last->Scalars.insert(Last->Scalars.begin(), VL.begin(), VL.end());
>
> Modified: llvm/trunk/tools/bugpoint/CrashDebugger.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CrashDebugger.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/bugpoint/CrashDebugger.cpp (original)
> +++ llvm/trunk/tools/bugpoint/CrashDebugger.cpp Fri May 29 14:43:39 2015
> @@ -385,8 +385,7 @@ bool ReduceCrashingBlocks::TestBlocks(st
> std::vector<std::pair<std::string, std::string> > BlockInfo;
>
> for (BasicBlock *BB : Blocks)
> - BlockInfo.push_back(std::make_pair(BB->getParent()->getName(),
> - BB->getName()));
> + BlockInfo.emplace_back(BB->getParent()->getName(), BB->getName());
>
> // Now run the CFG simplify pass on the function...
> std::vector<std::string> Passes;
>
> Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original)
> +++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Fri May 29 14:43:39 2015
> @@ -386,10 +386,8 @@ static bool ExtractLoops(BugDriver &BD,
> // that masked the error. Stop loop extraction now.
>
> std::vector<std::pair<std::string, FunctionType*> >
> MisCompFunctions;
> - for (unsigned i = 0, e = MiscompiledFunctions.size(); i != e; ++i) {
> - Function *F = MiscompiledFunctions[i];
> - MisCompFunctions.push_back(std::make_pair(F->getName(),
> - F->getFunctionType()));
> + for (Function *F : MiscompiledFunctions) {
> + MisCompFunctions.emplace_back(F->getName(), F->getFunctionType());
> }
>
> if (Linker::LinkModules(ToNotOptimize, ToOptimizeLoopExtracted))
> @@ -414,8 +412,7 @@ static bool ExtractLoops(BugDriver &BD,
> for (Module::iterator I = ToOptimizeLoopExtracted->begin(),
> E = ToOptimizeLoopExtracted->end(); I != E; ++I)
> if (!I->isDeclaration())
> - MisCompFunctions.push_back(std::make_pair(I->getName(),
> - I->getFunctionType()));
> + MisCompFunctions.emplace_back(I->getName(), I->getFunctionType());
>
> // Okay, great! Now we know that we extracted a loop and that loop
> // extraction both didn't break the program, and didn't mask the
> problem.
> @@ -596,8 +593,7 @@ static bool ExtractBlocks(BugDriver &BD,
> for (Module::iterator I = Extracted->begin(), E = Extracted->end();
> I != E; ++I)
> if (!I->isDeclaration())
> - MisCompFunctions.push_back(std::make_pair(I->getName(),
> - I->getFunctionType()));
> + MisCompFunctions.emplace_back(I->getName(), I->getFunctionType());
>
> if (Linker::LinkModules(ProgClone, Extracted.get()))
> exit(1);
>
> Modified: llvm/trunk/tools/lli/OrcLazyJIT.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.h?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/lli/OrcLazyJIT.h (original)
> +++ llvm/trunk/tools/lli/OrcLazyJIT.h Fri May 29 14:43:39 2015
> @@ -116,8 +116,7 @@ public:
> orc::CtorDtorRunner<CODLayerT> CtorRunner(std::move(CtorNames), H);
> CtorRunner.runViaLayer(CODLayer);
>
> - IRStaticDestructorRunners.push_back(
> - orc::CtorDtorRunner<CODLayerT>(std::move(DtorNames), H));
> + IRStaticDestructorRunners.emplace_back(std::move(DtorNames), H);
>
> return H;
> }
>
> Modified: llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CodeCoverage.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/llvm-cov/CodeCoverage.cpp (original)
> +++ llvm/trunk/tools/llvm-cov/CodeCoverage.cpp Fri May 29 14:43:39 2015
> @@ -116,8 +116,7 @@ CodeCoverageTool::getSourceFile(StringRe
> error(EC.message(), SourceFile);
> return EC;
> }
> - LoadedSourceFiles.push_back(
> - std::make_pair(SourceFile, std::move(Buffer.get())));
> + LoadedSourceFiles.emplace_back(SourceFile, std::move(Buffer.get()));
> return *LoadedSourceFiles.back().second;
> }
>
>
> Modified: llvm/trunk/tools/llvm-pdbdump/LinePrinter.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbdump/LinePrinter.h?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/llvm-pdbdump/LinePrinter.h (original)
> +++ llvm/trunk/tools/llvm-pdbdump/LinePrinter.h Fri May 29 14:43:39 2015
> @@ -41,7 +41,7 @@ private:
> void SetFilters(std::list<Regex> &List, Iter Begin, Iter End) {
> List.clear();
> for (; Begin != End; ++Begin)
> - List.push_back(StringRef(*Begin));
> + List.emplace_back(StringRef(*Begin));
> }
>
> raw_ostream &OS;
>
> Modified: llvm/trunk/utils/FileCheck/FileCheck.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/FileCheck/FileCheck.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/FileCheck/FileCheck.cpp (original)
> +++ llvm/trunk/utils/FileCheck/FileCheck.cpp Fri May 29 14:43:39 2015
> @@ -946,10 +946,7 @@ static bool ReadCheckFile(SourceMgr &SM,
> }
>
> // Okay, add the string we captured to the output vector and move on.
> - CheckStrings.push_back(CheckString(P,
> - UsedPrefix,
> - PatternLoc,
> - CheckTy));
> + CheckStrings.emplace_back(P, UsedPrefix, PatternLoc, CheckTy);
> std::swap(DagNotMatches, CheckStrings.back().DagNotStrings);
> DagNotMatches = ImplicitNegativeChecks;
> }
> @@ -957,10 +954,9 @@ static bool ReadCheckFile(SourceMgr &SM,
> // Add an EOF pattern for any trailing CHECK-DAG/-NOTs, and use the
> first
> // prefix as a filler for the error message.
> if (!DagNotMatches.empty()) {
> - CheckStrings.push_back(CheckString(Pattern(Check::CheckEOF),
> - *CheckPrefixes.begin(),
> -
> SMLoc::getFromPointer(Buffer.data()),
> - Check::CheckEOF));
> + CheckStrings.emplace_back(Pattern(Check::CheckEOF),
> *CheckPrefixes.begin(),
> + SMLoc::getFromPointer(Buffer.data()),
> + Check::CheckEOF);
> std::swap(DagNotMatches, CheckStrings.back().DagNotStrings);
> }
>
>
> Modified: llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp (original)
> +++ llvm/trunk/utils/TableGen/AsmMatcherEmitter.cpp Fri May 29 14:43:39
> 2015
> @@ -1797,7 +1797,7 @@ static void emitConvertFuncs(CodeGenTarg
>
> getEnumNameForToken(AsmMatchConverter));
>
> // Add the converter row for this instruction.
> - ConversionTable.push_back(std::vector<uint8_t>());
> + ConversionTable.emplace_back();
> ConversionTable.back().push_back(KindID);
> ConversionTable.back().push_back(CVT_Done);
>
> @@ -2161,8 +2161,7 @@ static void emitMatchTokenString(CodeGen
> std::vector<StringMatcher::StringPair> Matches;
> for (const auto &CI : Infos) {
> if (CI.Kind == ClassInfo::Token)
> - Matches.push_back(
> - StringMatcher::StringPair(CI.ValueName, "return " + CI.Name +
> ";"));
> + Matches.emplace_back(CI.ValueName, "return " + CI.Name + ";");
> }
>
> OS << "static MatchClassKind matchTokenString(StringRef Name) {\n";
> @@ -2184,9 +2183,8 @@ static void emitMatchRegisterName(CodeGe
> if (Reg.TheDef->getValueAsString("AsmName").empty())
> continue;
>
> - Matches.push_back(
> - StringMatcher::StringPair(Reg.TheDef->getValueAsString("AsmName"),
> - "return " + utostr(Reg.EnumValue) +
> ";"));
> + Matches.emplace_back(Reg.TheDef->getValueAsString("AsmName"),
> + "return " + utostr(Reg.EnumValue) + ";");
> }
>
> OS << "static unsigned MatchRegisterName(StringRef Name) {\n";
>
> Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original)
> +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Fri May 29 14:43:39 2015
> @@ -1105,9 +1105,8 @@ AsmWriterEmitter::AsmWriterEmitter(Recor
> Record *AsmWriter = Target.getAsmWriter();
> for (const CodeGenInstruction *I : Target.instructions())
> if (!I->AsmString.empty() && I->TheDef->getName() != "PHI")
> - Instructions.push_back(
> - AsmWriterInst(*I, AsmWriter->getValueAsInt("Variant"),
> - AsmWriter->getValueAsInt("PassSubtarget")));
> + Instructions.emplace_back(*I, AsmWriter->getValueAsInt("Variant"),
> +
> AsmWriter->getValueAsInt("PassSubtarget"));
>
> // Get the instruction numbering.
> NumberedInstructions = &Target.getInstructionsByEnumValue();
>
> Modified: llvm/trunk/utils/TableGen/AsmWriterInst.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterInst.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/AsmWriterInst.cpp (original)
> +++ llvm/trunk/utils/TableGen/AsmWriterInst.cpp Fri May 29 14:43:39 2015
> @@ -163,27 +163,22 @@ AsmWriterInst::AsmWriterInst(const CodeG
>
> if (VarName.empty()) {
> // Just a modifier, pass this into PrintSpecial.
> - Operands.push_back(AsmWriterOperand("PrintSpecial",
> - ~0U,
> - ~0U,
> - Modifier,
> - PassSubtarget));
> + Operands.emplace_back("PrintSpecial", ~0U, ~0U, Modifier,
> + PassSubtarget);
> } else {
> // Otherwise, normal operand.
> unsigned OpNo = CGI.Operands.getOperandNamed(VarName);
> CGIOperandList::OperandInfo OpInfo = CGI.Operands[OpNo];
>
> unsigned MIOp = OpInfo.MIOperandNo;
> - Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName,
> - OpNo, MIOp, Modifier,
> - PassSubtarget));
> + Operands.emplace_back(OpInfo.PrinterMethodName, OpNo, MIOp,
> Modifier,
> + PassSubtarget);
> }
> LastEmitted = VarEnd;
> }
> }
>
> - Operands.push_back(AsmWriterOperand("return;",
> - AsmWriterOperand::isLiteralStatementOperand));
> + Operands.emplace_back("return;",
> AsmWriterOperand::isLiteralStatementOperand);
> }
>
> /// MatchesAllButOneOp - If this instruction is exactly identical to the
>
> Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
> +++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Fri May 29 14:43:39
> 2015
> @@ -3798,13 +3798,11 @@ void CodeGenDAGPatterns::GenerateVariant
> if (AlreadyExists) continue;
>
> // Otherwise, add it to the list of patterns we have.
> - PatternsToMatch.
> - push_back(PatternToMatch(PatternsToMatch[i].getSrcRecord(),
> - PatternsToMatch[i].getPredicates(),
> - Variant,
> PatternsToMatch[i].getDstPattern(),
> - PatternsToMatch[i].getDstRegs(),
> - PatternsToMatch[i].getAddedComplexity(),
> - Record::getNewUID()));
> + PatternsToMatch.emplace_back(
> + PatternsToMatch[i].getSrcRecord(),
> PatternsToMatch[i].getPredicates(),
> + Variant, PatternsToMatch[i].getDstPattern(),
> + PatternsToMatch[i].getDstRegs(),
> + PatternsToMatch[i].getAddedComplexity(), Record::getNewUID());
> }
>
> DEBUG(errs() << "\n");
>
> Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/CodeGenInstruction.cpp (original)
> +++ llvm/trunk/utils/TableGen/CodeGenInstruction.cpp Fri May 29 14:43:39
> 2015
> @@ -115,9 +115,9 @@ CGIOperandList::CGIOperandList(Record *R
> PrintFatalError("In instruction '" + R->getName() + "', operand #" +
> Twine(i) + " has the same name as a previous
> operand!");
>
> - OperandList.push_back(OperandInfo(Rec, ArgName, PrintMethod,
> EncoderMethod,
> - OperandNamespace + "::" +
> OperandType,
> - MIOperandNo, NumOps, MIOpInfo));
> + OperandList.emplace_back(Rec, ArgName, PrintMethod, EncoderMethod,
> + OperandNamespace + "::" + OperandType,
> MIOperandNo,
> + NumOps, MIOpInfo);
> MIOperandNo += NumOps;
> }
>
> @@ -642,9 +642,9 @@ CodeGenInstAlias::CodeGenInstAlias(Recor
>
> // Take care to instantiate each of the suboperands with the
> correct
> // nomenclature: $foo.bar
> - ResultOperands.push_back(
> - ResultOperand(Result->getArgName(AliasOpNo) + "." +
> - MIOI->getArgName(SubOp), SubRec));
> + ResultOperands.emplace_back(Result->getArgName(AliasOpNo) + "."
> +
> + MIOI->getArgName(SubOp),
> + SubRec);
> ResultInstOperandIndex.push_back(std::make_pair(i, SubOp));
> }
> ++AliasOpNo;
>
> Modified: llvm/trunk/utils/TableGen/CodeGenRegisters.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenRegisters.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/CodeGenRegisters.cpp (original)
> +++ llvm/trunk/utils/TableGen/CodeGenRegisters.cpp Fri May 29 14:43:39 2015
> @@ -994,7 +994,7 @@ CodeGenRegBank::CodeGenRegBank(RecordKee
>
> // Allocate user-defined register classes.
> for (auto *RC : RCs) {
> - RegClasses.push_back(CodeGenRegisterClass(*this, RC));
> + RegClasses.emplace_back(*this, RC);
> addToMaps(&RegClasses.back());
> }
>
> @@ -1056,7 +1056,7 @@ CodeGenRegBank::getOrCreateSubClass(cons
> return FoundI->second;
>
> // Sub-class doesn't exist, create a new one.
> - RegClasses.push_back(CodeGenRegisterClass(*this, Name, K));
> + RegClasses.emplace_back(*this, Name, K);
> addToMaps(&RegClasses.back());
> return &RegClasses.back();
> }
>
> Modified: llvm/trunk/utils/TableGen/CodeGenSchedule.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenSchedule.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/CodeGenSchedule.cpp (original)
> +++ llvm/trunk/utils/TableGen/CodeGenSchedule.cpp Fri May 29 14:43:39 2015
> @@ -145,8 +145,7 @@ void CodeGenSchedModels::collectProcMode
> // Use idx=0 for NoModel/NoItineraries.
> Record *NoModelDef = Records.getDef("NoSchedModel");
> Record *NoItinsDef = Records.getDef("NoItineraries");
> - ProcModels.push_back(CodeGenProcModel(0, "NoSchedModel",
> - NoModelDef, NoItinsDef));
> + ProcModels.emplace_back(0, "NoSchedModel", NoModelDef, NoItinsDef);
> ProcModelMap[NoModelDef] = 0;
>
> // For each processor, find a unique machine model.
> @@ -164,16 +163,14 @@ void CodeGenSchedModels::addProcModel(Re
> std::string Name = ModelKey->getName();
> if (ModelKey->isSubClassOf("SchedMachineModel")) {
> Record *ItinsDef = ModelKey->getValueAsDef("Itineraries");
> - ProcModels.push_back(
> - CodeGenProcModel(ProcModels.size(), Name, ModelKey, ItinsDef));
> + ProcModels.emplace_back(ProcModels.size(), Name, ModelKey, ItinsDef);
> }
> else {
> // An itinerary is defined without a machine model. Infer a new model.
> if (!ModelKey->getValueAsListOfDefs("IID").empty())
> Name = Name + "Model";
> - ProcModels.push_back(
> - CodeGenProcModel(ProcModels.size(), Name,
> - ProcDef->getValueAsDef("SchedModel"), ModelKey));
> + ProcModels.emplace_back(ProcModels.size(), Name,
> + ProcDef->getValueAsDef("SchedModel"),
> ModelKey);
> }
> DEBUG(ProcModels.back().dump());
> }
> @@ -281,12 +278,12 @@ void CodeGenSchedModels::collectSchedRW(
> std::sort(SWDefs.begin(), SWDefs.end(), LessRecord());
> for (RecIter SWI = SWDefs.begin(), SWE = SWDefs.end(); SWI != SWE;
> ++SWI) {
> assert(!getSchedRWIdx(*SWI, /*IsRead=*/false) && "duplicate
> SchedWrite");
> - SchedWrites.push_back(CodeGenSchedRW(SchedWrites.size(), *SWI));
> + SchedWrites.emplace_back(SchedWrites.size(), *SWI);
> }
> std::sort(SRDefs.begin(), SRDefs.end(), LessRecord());
> for (RecIter SRI = SRDefs.begin(), SRE = SRDefs.end(); SRI != SRE;
> ++SRI) {
> assert(!getSchedRWIdx(*SRI, /*IsRead-*/true) && "duplicate
> SchedWrite");
> - SchedReads.push_back(CodeGenSchedRW(SchedReads.size(), *SRI));
> + SchedReads.emplace_back(SchedReads.size(), *SRI);
> }
> // Initialize WriteSequence vectors.
> for (std::vector<CodeGenSchedRW>::iterator WI = SchedWrites.begin(),
>
> Modified: llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp (original)
> +++ llvm/trunk/utils/TableGen/FixedLenDecoderEmitter.cpp Fri May 29
> 14:43:39 2015
> @@ -610,7 +610,7 @@ void Filter::emitTableEntry(DecoderTable
> TableInfo.Table.push_back(NumBits);
>
> // A new filter entry begins a new scope for fixup resolution.
> - TableInfo.FixupStack.push_back(FixupList());
> + TableInfo.FixupStack.emplace_back();
>
> DecoderTable &Table = TableInfo.Table;
>
> @@ -1333,7 +1333,7 @@ void FilterChooser::emitSingletonTableEn
>
> // complex singletons need predicate checks from the first singleton
> // to refer forward to the variable filterchooser that follows.
> - TableInfo.FixupStack.push_back(FixupList());
> + TableInfo.FixupStack.emplace_back();
>
> emitSingletonTableEntry(TableInfo, Opc);
>
> @@ -1350,7 +1350,7 @@ void FilterChooser::emitSingletonTableEn
> void FilterChooser::runSingleFilter(unsigned startBit, unsigned numBit,
> bool mixed) {
> Filters.clear();
> - Filters.push_back(Filter(*this, startBit, numBit, true));
> + Filters.emplace_back(*this, startBit, numBit, true);
> BestIndex = 0; // Sole Filter instance to choose from.
> bestFilter().recurse();
> }
> @@ -1360,9 +1360,9 @@ void FilterChooser::runSingleFilter(unsi
> void FilterChooser::reportRegion(bitAttr_t RA, unsigned StartBit,
> unsigned BitIndex, bool AllowMixed) {
> if (RA == ATTR_MIXED && AllowMixed)
> - Filters.push_back(Filter(*this, StartBit, BitIndex - StartBit, true));
> + Filters.emplace_back(*this, StartBit, BitIndex - StartBit, true);
> else if (RA == ATTR_ALL_SET && !AllowMixed)
> - Filters.push_back(Filter(*this, StartBit, BitIndex - StartBit,
> false));
> + Filters.emplace_back(*this, StartBit, BitIndex - StartBit, false);
> }
>
> // FilterProcessor scans the well-known encoding bits of the instructions
> and
> @@ -2179,7 +2179,7 @@ void FixedLenDecoderEmitter::run(raw_ost
> TableInfo.Table.clear();
> TableInfo.FixupStack.clear();
> TableInfo.Table.reserve(16384);
> - TableInfo.FixupStack.push_back(FixupList());
> + TableInfo.FixupStack.emplace_back();
> FC.emitTableEntries(TableInfo);
> // Any NumToSkip fixups in the top level scope can resolve to the
> // OPC_Fail at the end of the table.
>
> Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=238602&r1=238601&r2=238602&view=diff
>
> ==============================================================================
> --- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original)
> +++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Fri May 29 14:43:39 2015
> @@ -760,7 +760,7 @@ static void EmitTargetBuiltins(const std
> E = BIM.end(); I != E; ++I) {
> std::string ResultCode =
> "return " + TargetPrefix + "Intrinsic::" + I->second + ";";
> - Results.push_back(StringMatcher::StringPair(I->first, ResultCode));
> + Results.emplace_back(I->first, ResultCode);
> }
>
> StringMatcher("BuiltinName", Results, OS).Emit();
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150529/d498f8b2/attachment.html>
More information about the llvm-commits
mailing list