summaryrefslogtreecommitdiff
path: root/tools/llvm-lto2/llvm-lto2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-lto2/llvm-lto2.cpp')
-rw-r--r--tools/llvm-lto2/llvm-lto2.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/tools/llvm-lto2/llvm-lto2.cpp b/tools/llvm-lto2/llvm-lto2.cpp
index 5426e040cd7c..70aae0f41507 100644
--- a/tools/llvm-lto2/llvm-lto2.cpp
+++ b/tools/llvm-lto2/llvm-lto2.cpp
@@ -17,7 +17,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Bitcode/BitcodeReader.h"
-#include "llvm/CodeGen/CommandFlags.h"
+#include "llvm/CodeGen/CommandFlags.def"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/LTO/Caching.h"
#include "llvm/LTO/LTO.h"
@@ -100,11 +100,19 @@ static cl::opt<bool> OptRemarksWithHotness(
cl::desc("Whether to include hotness informations in the remarks.\n"
"Has effect only if -pass-remarks-output is specified."));
+static cl::opt<std::string>
+ SamplePGOFile("lto-sample-profile-file",
+ cl::desc("Specify a SamplePGO profile file"));
+
static cl::opt<bool>
UseNewPM("use-new-pm",
cl::desc("Run LTO passes using the new pass manager"),
cl::init(false), cl::Hidden);
+static cl::opt<bool>
+ DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden,
+ cl::desc("Print pass management debugging information"));
+
static void check(Error E, std::string Msg) {
if (!E)
return;
@@ -189,7 +197,9 @@ static int run(int argc, char **argv) {
Conf.MAttrs = MAttrs;
if (auto RM = getRelocModel())
Conf.RelocModel = *RM;
- Conf.CodeModel = CMModel;
+ Conf.CodeModel = getCodeModel();
+
+ Conf.DebugPassManager = DebugPassManager;
if (SaveTemps)
check(Conf.addSaveTemps(OutputFilename + "."),
@@ -199,6 +209,8 @@ static int run(int argc, char **argv) {
Conf.RemarksFilename = OptRemarksOutput;
Conf.RemarksWithHotness = OptRemarksWithHotness;
+ Conf.SampleProfile = SamplePGOFile;
+
// Run a custom pipeline, if asked for.
Conf.OptPipeline = OptPipeline;
Conf.AAPipeline = AAPipeline;
@@ -284,7 +296,8 @@ static int run(int argc, char **argv) {
return llvm::make_unique<lto::NativeObjectStream>(std::move(S));
};
- auto AddBuffer = [&](size_t Task, std::unique_ptr<MemoryBuffer> MB) {
+ auto AddBuffer = [&](size_t Task, std::unique_ptr<MemoryBuffer> MB,
+ StringRef Path) {
*AddStream(Task)->OS << MB->getBuffer();
};
@@ -355,6 +368,9 @@ static int dumpSymtab(int argc, char **argv) {
if (TT.isOSBinFormatCOFF() && Sym.isWeak() && Sym.isIndirect())
outs() << " fallback " << Sym.getCOFFWeakExternalFallback() << '\n';
+
+ if (!Sym.getSectionName().empty())
+ outs() << " section " << Sym.getSectionName() << "\n";
}
outs() << '\n';