diff options
author | Fangrui Song <maskray@google.com> | 2019-04-10 14:52:37 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-04-10 14:52:37 +0000 |
commit | ae6c9403d136b292125538b4097d90310ff48abf (patch) | |
tree | 2b902f61f7fb8e4919ff6c44ad2d2e6f6556caa0 /llvm/lib/CodeGen/MachineOutliner.cpp | |
parent | 6a7412a893da45867fe66fdf852a653956fb998c (diff) | |
download | llvm-ae6c9403d136b292125538b4097d90310ff48abf.zip llvm-ae6c9403d136b292125538b4097d90310ff48abf.tar.gz llvm-ae6c9403d136b292125538b4097d90310ff48abf.tar.bz2 |
[MachineOutliner] Replace ostringstream based string concatenation with Twine
This makes my libLLVMCodeGen.so.9svn 4936 bytes smaller.
While here, delete unused #include <map>
llvm-svn: 358089
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineOutliner.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp index 8c06260..7b1750a 100644 --- a/llvm/lib/CodeGen/MachineOutliner.cpp +++ b/llvm/lib/CodeGen/MachineOutliner.cpp @@ -73,8 +73,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include <functional> -#include <map> -#include <sstream> #include <tuple> #include <vector> @@ -1094,19 +1092,15 @@ MachineOutliner::createOutlinedFunction(Module &M, OutlinedFunction &OF, InstructionMapper &Mapper, unsigned Name) { - // Create the function name. This should be unique. For now, just hash the - // module name and include it in the function name plus the number of this - // function. - std::ostringstream NameStream; + // Create the function name. This should be unique. // FIXME: We should have a better naming scheme. This should be stable, // regardless of changes to the outliner's cost model/traversal order. - NameStream << "OUTLINED_FUNCTION_" << Name; + std::string FunctionName = ("OUTLINED_FUNCTION_" + Twine(Name)).str(); // Create the function using an IR-level function. LLVMContext &C = M.getContext(); - Function *F = - Function::Create(FunctionType::get(Type::getVoidTy(C), false), - Function::ExternalLinkage, NameStream.str(), M); + Function *F = Function::Create(FunctionType::get(Type::getVoidTy(C), false), + Function::ExternalLinkage, FunctionName, M); // NOTE: If this is linkonceodr, then we can take advantage of linker deduping // which gives us better results when we outline from linkonceodr functions. |