summaryrefslogtreecommitdiffstats
path: root/lld
diff options
context:
space:
mode:
Diffstat (limited to 'lld')
-rw-r--r--lld/ELF/Config.h1
-rw-r--r--lld/ELF/Driver.cpp1
-rw-r--r--lld/ELF/LTO.cpp1
-rw-r--r--lld/ELF/Options.td2
-rw-r--r--lld/docs/ld.lld.13
-rw-r--r--lld/test/ELF/lto/opt-remarks.ll5
6 files changed, 13 insertions, 0 deletions
diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h
index 9981098eb6c..a6b96b40548 100644
--- a/lld/ELF/Config.h
+++ b/lld/ELF/Config.h
@@ -99,6 +99,7 @@ struct Configuration {
llvm::StringRef MapFile;
llvm::StringRef OutputFile;
llvm::StringRef OptRemarksFilename;
+ llvm::StringRef OptRemarksPasses;
llvm::StringRef ProgName;
llvm::StringRef SoName;
llvm::StringRef Sysroot;
diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp
index 44f2293f199..c27e36f94a2 100644
--- a/lld/ELF/Driver.cpp
+++ b/lld/ELF/Driver.cpp
@@ -818,6 +818,7 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args) {
Config->OFormatBinary = isOutputFormatBinary(Args);
Config->Omagic = Args.hasFlag(OPT_omagic, OPT_no_omagic, false);
Config->OptRemarksFilename = Args.getLastArgValue(OPT_opt_remarks_filename);
+ Config->OptRemarksPasses = Args.getLastArgValue(OPT_opt_remarks_passes);
Config->OptRemarksWithHotness = Args.hasArg(OPT_opt_remarks_with_hotness);
Config->Optimize = args::getInteger(Args, OPT_O, 1);
Config->OrphanHandling = getOrphanHandling(Args);
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp
index b19996d5e9a..c97ff4d2476 100644
--- a/lld/ELF/LTO.cpp
+++ b/lld/ELF/LTO.cpp
@@ -97,6 +97,7 @@ static lto::Config createConfig() {
// Set up optimization remarks if we've been asked to.
C.RemarksFilename = Config->OptRemarksFilename;
+ C.RemarksPasses = Config->OptRemarksPasses;
C.RemarksWithHotness = Config->OptRemarksWithHotness;
C.SampleProfile = Config->LTOSampleProfile;
diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index 013235287b3..968cf1900b6 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -454,6 +454,8 @@ def disable_verify: F<"disable-verify">;
defm mllvm: Eq<"mllvm", "Additional arguments to forward to LLVM's option processing">;
def opt_remarks_filename: Separate<["--"], "opt-remarks-filename">,
HelpText<"YAML output file for optimization remarks">;
+def opt_remarks_passes: Separate<["--"], "opt-remarks-passes">,
+ HelpText<"Regex for the passes that need to be serialized to the output file">;
def opt_remarks_with_hotness: Flag<["--"], "opt-remarks-with-hotness">,
HelpText<"Include hotness information in the optimization remarks file">;
defm plugin_opt: Eq<"plugin-opt", "specifies LTO options for compatibility with GNU linkers">;
diff --git a/lld/docs/ld.lld.1 b/lld/docs/ld.lld.1
index 2e499bac81e..d18914ca509 100644
--- a/lld/docs/ld.lld.1
+++ b/lld/docs/ld.lld.1
@@ -329,6 +329,9 @@ Set the text and data sections to be readable and writable.
.It Fl -opt-remarks-filename Ar file
Write optimization remarks in YAML format to
.Ar file .
+.It Fl -opt-remarks-passes Ar pass-regex
+Filter optimization remarks by only allowing the passes matching
+.Ar pass-regex .
.It Fl -opt-remarks-with-hotness
Include hotness information in the optimization remarks file.
.It Fl -orphan-handling Ns = Ns Ar mode
diff --git a/lld/test/ELF/lto/opt-remarks.ll b/lld/test/ELF/lto/opt-remarks.ll
index bef7e016a1c..e37bfd345ac 100644
--- a/lld/test/ELF/lto/opt-remarks.ll
+++ b/lld/test/ELF/lto/opt-remarks.ll
@@ -8,6 +8,9 @@
; RUN: %t.o -o %t -shared
; RUN: cat %t.yaml | FileCheck %s -check-prefix=YAML
; RUN: cat %t.hot.yaml | FileCheck %s -check-prefix=YAML-HOT
+; RUN: ld.lld --opt-remarks-filename %t1.yaml --opt-remarks-passes inline %t.o \
+; RUN: -o /dev/null -shared
+; RUN: cat %t1.yaml | FileCheck %s -check-prefix=YAML-PASSES
; Check that @tinkywinky is inlined after optimizations.
; CHECK-LABEL: define i32 @main
@@ -48,6 +51,8 @@
; YAML-HOT-NEXT: - String: ')'
; YAML-HOT-NEXT: ...
+; YAML-PASSES: Pass: inline
+
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-scei-ps4"
OpenPOWER on IntegriCloud