[PATCH] D34080: [ThinLTO] Add dump-summary command to llvm-lto2 tool
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 12 12:05:57 PDT 2017
How does this relate to the other patch, D34063? (trying to understand
which pieces do what, etc)
That said, I'd really like to go back & have a discussion about whether
this is all the right direction, given a desire/need to have .ll
consistency with .bc files (ie: a roundtrippable representation of
summaries in .ll files).
- Dave
On Sat, Jun 10, 2017 at 7:47 AM Charles Saternos via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:
> ncharlie created this revision.
> Herald added subscribers: inglorion, Prazek.
>
> [ThinLTO] Add dump-summary command to llvm-lto2 tool
>
> Adds command to dump ThinLTO module summaries in YAML to the llvm-lto2
> tool.
>
>
> https://reviews.llvm.org/D34080
>
> Files:
> test/tools/llvm-lto2/X86/dump-summary.ll
> tools/llvm-lto2/llvm-lto2.cpp
>
>
> Index: tools/llvm-lto2/llvm-lto2.cpp
> ===================================================================
> --- tools/llvm-lto2/llvm-lto2.cpp
> +++ tools/llvm-lto2/llvm-lto2.cpp
> @@ -16,9 +16,11 @@
> //
>
> //===----------------------------------------------------------------------===//
>
> -#include "llvm/LTO/Caching.h"
> +#include "llvm/Bitcode/BitcodeReader.h"
> #include "llvm/CodeGen/CommandFlags.h"
> #include "llvm/IR/DiagnosticPrinter.h"
> +#include "llvm/IR/ModuleSummaryIndexYAML.h"
> +#include "llvm/LTO/Caching.h"
> #include "llvm/LTO/LTO.h"
> #include "llvm/Support/CommandLine.h"
> #include "llvm/Support/FileSystem.h"
> @@ -132,7 +134,7 @@
> }
>
> static int usage() {
> - errs() << "Available subcommands: dump-symtab run\n";
> + errs() << "Available subcommands: dump-symtab dump-summary run\n";
> return 1;
> }
>
> @@ -351,6 +353,19 @@
> return 0;
> }
>
> +static int dumpSummary(int argc, char **argv) {
> + for (StringRef F : make_range(argv + 1, argv + argc)) {
> + std::unique_ptr<MemoryBuffer> MB = check(MemoryBuffer::getFile(F), F);
> + std::unique_ptr<ModuleSummaryIndex> Index =
> + check(getModuleSummaryIndex(*MB), F);
> +
> + yaml::Output Out(outs());
> + Out << *Index;
> + }
> +
> + return 0;
> +}
> +
> int main(int argc, char **argv) {
> InitializeAllTargets();
> InitializeAllTargetMCs();
> @@ -368,6 +383,8 @@
> argv[1] = argv[0];
> if (Subcommand == "dump-symtab")
> return dumpSymtab(argc - 1, argv + 1);
> + if (Subcommand == "dump-summary")
> + return dumpSummary(argc - 1, argv + 1);
> if (Subcommand == "run")
> return run(argc - 1, argv + 1);
> return usage();
> Index: test/tools/llvm-lto2/X86/dump-summary.ll
> ===================================================================
> --- /dev/null
> +++ test/tools/llvm-lto2/X86/dump-summary.ll
> @@ -0,0 +1,17 @@
> +; RUN: opt -module-summary %s -o %t.o
> +; RUN: llvm-lto2 dump-summary %t.o | egrep 'Linkage:\s+0'
> +; RUN: llvm-lto2 dump-summary %t.o | egrep 'Live:\s+false'
> +; RUN: llvm-lto2 dump-summary %t.o | egrep 'NotEligibleToImport:\s+false'
> +
> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
> +target triple = "x86_64-unknown-linux-gnu"
> + at G = constant i32 2048, align 4
> + at a = weak alias i32, i32* @G
> +
> +define void @boop() {
> + tail call void @afun()
> + ret void
> +}
> +
> +declare void @afun()
> +declare void @testtest()
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170612/ea6af1c2/attachment.html>
More information about the llvm-commits
mailing list