<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Jun 12, 2017 at 12:13 PM Peter Collingbourne <<a href="mailto:peter@pcc.me.uk">peter@pcc.me.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I think we should start with this patch so that we aren't forced to go further in what I hope is clearly the wrong direction.</div></blockquote><div><br>I'm not sure what you mean - it feels to me like this patch is "going further in what is clearly the wrong direction" - a direction that's adding workarounds by providing dumping features instead of roundtrippable .ll syntax?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"> We already have a number of hard to maintain tests that use llvm-bcanalyzer output, and I just recently needed to add another one:<div><a href="http://llvm-cs.pcc.me.uk/test/Transforms/ThinLTOBitcodeWriter/split.ll#29" target="_blank">http://llvm-cs.pcc.me.uk/test/Transforms/ThinLTOBitcodeWriter/split.ll#29</a></div></div></blockquote><div><br>Sure - and I'd like those to be fixed in the way that all the other IR tests tend to work - by using a common .ll representation of what's in .bc files.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>We can decide on the direction in parallel with landing this patch. </div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>Peter</div></div><div class="gmail_extra"></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 12, 2017 at 12:05 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">How does this relate to the other patch, D34063? (trying to understand which pieces do what, etc)<br><br>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).<br><br>- Dave<br><br><div class="gmail_quote"><div><div class="m_-576177836348287723h5"><div dir="ltr">On Sat, Jun 10, 2017 at 7:47 AM Charles Saternos via Phabricator via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-576177836348287723h5">ncharlie created this revision.<br>
Herald added subscribers: inglorion, Prazek.<br>
<br>
[ThinLTO] Add dump-summary command to llvm-lto2 tool<br>
<br>
Adds command to dump ThinLTO module summaries in YAML to the llvm-lto2 tool.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D34080" rel="noreferrer" target="_blank">https://reviews.llvm.org/D34080</a><br>
<br>
Files:<br>
  test/tools/llvm-lto2/X86/dump-summary.ll<br>
  tools/llvm-lto2/llvm-lto2.cpp<br>
<br>
<br>
Index: tools/llvm-lto2/llvm-lto2.cpp<br>
===================================================================<br>
--- tools/llvm-lto2/llvm-lto2.cpp<br>
+++ tools/llvm-lto2/llvm-lto2.cpp<br>
@@ -16,9 +16,11 @@<br>
 //<br>
 //===----------------------------------------------------------------------===//<br>
<br>
-#include "llvm/LTO/Caching.h"<br>
+#include "llvm/Bitcode/BitcodeReader.h"<br>
 #include "llvm/CodeGen/CommandFlags.h"<br>
 #include "llvm/IR/DiagnosticPrinter.h"<br>
+#include "llvm/IR/ModuleSummaryIndexYAML.h"<br>
+#include "llvm/LTO/Caching.h"<br>
 #include "llvm/LTO/LTO.h"<br>
 #include "llvm/Support/CommandLine.h"<br>
 #include "llvm/Support/FileSystem.h"<br>
@@ -132,7 +134,7 @@<br>
 }<br>
<br>
 static int usage() {<br>
-  errs() << "Available subcommands: dump-symtab run\n";<br>
+  errs() << "Available subcommands: dump-symtab dump-summary run\n";<br>
   return 1;<br>
 }<br>
<br>
@@ -351,6 +353,19 @@<br>
   return 0;<br>
 }<br>
<br>
+static int dumpSummary(int argc, char **argv) {<br>
+  for (StringRef F : make_range(argv + 1, argv + argc)) {<br>
+    std::unique_ptr<MemoryBuffer> MB = check(MemoryBuffer::getFile(F), F);<br>
+    std::unique_ptr<ModuleSummaryIndex> Index =<br>
+        check(getModuleSummaryIndex(*MB), F);<br>
+<br>
+    yaml::Output Out(outs());<br>
+    Out << *Index;<br>
+  }<br>
+<br>
+  return 0;<br>
+}<br>
+<br>
 int main(int argc, char **argv) {<br>
   InitializeAllTargets();<br>
   InitializeAllTargetMCs();<br>
@@ -368,6 +383,8 @@<br>
   argv[1] = argv[0];<br>
   if (Subcommand == "dump-symtab")<br>
     return dumpSymtab(argc - 1, argv + 1);<br>
+  if (Subcommand == "dump-summary")<br>
+    return dumpSummary(argc - 1, argv + 1);<br>
   if (Subcommand == "run")<br>
     return run(argc - 1, argv + 1);<br>
   return usage();<br>
Index: test/tools/llvm-lto2/X86/dump-summary.ll<br>
===================================================================<br>
--- /dev/null<br>
+++ test/tools/llvm-lto2/X86/dump-summary.ll<br>
@@ -0,0 +1,17 @@<br>
+; RUN: opt -module-summary %s -o %t.o<br>
+; RUN: llvm-lto2 dump-summary %t.o | egrep 'Linkage:\s+0'<br>
+; RUN: llvm-lto2 dump-summary %t.o | egrep 'Live:\s+false'<br>
+; RUN: llvm-lto2 dump-summary %t.o | egrep 'NotEligibleToImport:\s+false'<br>
+<br>
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"<br>
+target triple = "x86_64-unknown-linux-gnu"<br>
+@G = constant i32 2048, align 4<br>
+@a = weak alias i32, i32* @G<br>
+<br>
+define void @boop() {<br>
+  tail call void @afun()<br>
+  ret void<br>
+}<br>
+<br>
+declare void @afun()<br>
+declare void @testtest()<br>
<br>
<br></div></div>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div><div class="gmail_extra">-- <br><div class="m_-576177836348287723gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div></blockquote></div></div>