aboutsummaryrefslogtreecommitdiff
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.cpp55
1 files changed, 43 insertions, 12 deletions
diff --git a/tools/llvm-lto2/llvm-lto2.cpp b/tools/llvm-lto2/llvm-lto2.cpp
index 26426367e252..0bd9289dc938 100644
--- a/tools/llvm-lto2/llvm-lto2.cpp
+++ b/tools/llvm-lto2/llvm-lto2.cpp
@@ -1,9 +1,8 @@
//===-- llvm-lto2: test harness for the resolution-based LTO interface ----===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -92,19 +91,40 @@ static cl::opt<std::string> DefaultTriple(
cl::desc(
"Replace unspecified target triples in input files with this triple"));
+static cl::opt<bool> RemarksWithHotness(
+ "pass-remarks-with-hotness",
+ cl::desc("With PGO, include profile count in optimization remarks"),
+ cl::Hidden);
+
static cl::opt<std::string>
- OptRemarksOutput("pass-remarks-output",
- cl::desc("YAML output file for optimization remarks"));
+ RemarksFilename("pass-remarks-output",
+ cl::desc("Output filename for pass remarks"),
+ cl::value_desc("filename"));
-static cl::opt<bool> OptRemarksWithHotness(
- "pass-remarks-with-hotness",
- 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>
+ RemarksPasses("pass-remarks-filter",
+ cl::desc("Only record optimization remarks from passes whose "
+ "names match the given regular expression"),
+ cl::value_desc("regex"));
+
+static cl::opt<std::string> RemarksFormat(
+ "pass-remarks-format",
+ cl::desc("The format used for serializing remarks (default: YAML)"),
+ cl::value_desc("format"), cl::init("yaml"));
static cl::opt<std::string>
SamplePGOFile("lto-sample-profile-file",
cl::desc("Specify a SamplePGO profile file"));
+static cl::opt<std::string>
+ CSPGOFile("lto-cspgo-profile-file",
+ cl::desc("Specify a context sensitive PGO profile file"));
+
+static cl::opt<bool>
+ RunCSIRInstr("lto-cspgo-gen",
+ cl::desc("Run PGO context sensitive IR instrumentation"),
+ cl::init(false), cl::Hidden);
+
static cl::opt<bool>
UseNewPM("use-new-pm",
cl::desc("Run LTO passes using the new pass manager"),
@@ -211,10 +231,14 @@ static int run(int argc, char **argv) {
"Config::addSaveTemps failed");
// Optimization remarks.
- Conf.RemarksFilename = OptRemarksOutput;
- Conf.RemarksWithHotness = OptRemarksWithHotness;
+ Conf.RemarksFilename = RemarksFilename;
+ Conf.RemarksPasses = RemarksPasses;
+ Conf.RemarksWithHotness = RemarksWithHotness;
+ Conf.RemarksFormat = RemarksFormat;
Conf.SampleProfile = SamplePGOFile;
+ Conf.CSIRProfile = CSPGOFile;
+ Conf.RunCSIRInstr = RunCSIRInstr;
// Run a custom pipeline, if asked for.
Conf.OptPipeline = OptPipeline;
@@ -343,6 +367,13 @@ static int dumpSymtab(int argc, char **argv) {
if (TT.isOSBinFormatCOFF())
outs() << "linker opts: " << Input->getCOFFLinkerOpts() << '\n';
+ if (TT.isOSBinFormatELF()) {
+ outs() << "dependent libraries:";
+ for (auto L : Input->getDependentLibraries())
+ outs() << " \"" << L << "\"";
+ outs() << '\n';
+ }
+
std::vector<StringRef> ComdatTable = Input->getComdatTable();
for (const InputFile::Symbol &Sym : Input->symbols()) {
switch (Sym.getVisibility()) {