<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 12, 2017 at 12:59 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><span class="gmail-"><div dir="ltr">On Mon, Jun 12, 2017 at 12:20 PM Peter Collingbourne <<a href="mailto:peter@pcc.me.uk" target="_blank">peter@pcc.me.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 12, 2017 at 12:16 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><span><div dir="ltr">On Mon, Jun 12, 2017 at 12:13 PM Peter Collingbourne <<a href="mailto:peter@pcc.me.uk" target="_blank">peter@pcc.me.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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></span><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></div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I don't necessarily agree that this is the wrong direction or a workaround, which is why I think we should discuss it in parallel.</div></div></div></div></blockquote></span><div><br>This has already slipped further than is ideal - when bitcode support was added for summaries, .ll support should've been provided at the same time, as with any other bitcode feature in LLVM. This is a baseline requirement for features in LLVM's bitcode that seems to have been missed during the initial support/code review.<br></div></div></div></blockquote><div><br></div><div>While I wish I had added some dumping support to the .ll files much earlier, because it makes testing and analysis much easier, as was pointed out in the other thread, this is somewhat different than the IR since it is purely analysis results which summarizes the IR.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br>When YAML support was added for reading summaries, that would've been a great opportunity to go back and address this missing functionality.<br><br>Now that dumping support is needed/being added, there's another opportunity to go in that direction rather than continuing to work further away from it.<br></div></div></div></blockquote><div><br></div><div>We already have some YAM dumping support for part of the summaries, making this more accessible via an internal tool and usable doesn't at all preclude a parallel discussion about what is the right format for the .ll files. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"></div></div></div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div> </div><span class="gmail-"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> I hope you can agree in any case that testing for textual attribute names/values is better than testing for magic numbers.</div></div></div></div></blockquote></span><div><br>I agree that this is better, but I don't think it's going in the right direction and would like to avoid incurring further technical debt without much of an idea of how it would be cleaned up.<br></div></div></div></blockquote><div><br></div><div>I disagree, we know that there is a desire to get this in the .ll format, but discussions around what that format should look like may simply take some time. Adding support to facilitate using the existing YAML support in the meantime doesn't seem to add much technical debt.</div><div><br></div><div>Teresa</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br>- Dave<br> </div><div><div class="gmail-h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>Peter</div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div> </div><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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/<wbr>Transforms/<wbr>ThinLTOBitcodeWriter/split.ll#<wbr>29</a></div></div></blockquote></span><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><div><div class="gmail-m_6806243789727229603m_1191454515936963247h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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="gmail-m_6806243789727229603m_1191454515936963247m_-6321393146272278729m_-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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-m_6806243789727229603m_1191454515936963247m_-6321393146272278729m_-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/<wbr>D34080</a><br>
<br>
Files:<br>
  test/tools/llvm-lto2/X86/dump-<wbr>summary.ll<br>
  tools/llvm-lto2/llvm-lto2.cpp<br>
<br>
<br>
Index: tools/llvm-lto2/llvm-lto2.cpp<br>
==============================<wbr>==============================<wbr>=======<br>
--- tools/llvm-lto2/llvm-lto2.cpp<br>
+++ tools/llvm-lto2/llvm-lto2.cpp<br>
@@ -16,9 +16,11 @@<br>
 //<br>
 //===------------------------<wbr>------------------------------<wbr>----------------===//<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/<wbr>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)<wbr>, F);<br>
+    std::unique_ptr<<wbr>ModuleSummaryIndex> Index =<br>
+        check(getModuleSummaryIndex(*<wbr>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-<wbr>summary.ll<br>
==============================<wbr>==============================<wbr>=======<br>
--- /dev/null<br>
+++ test/tools/llvm-lto2/X86/dump-<wbr>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:<wbr>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>
______________________________<wbr>_________________<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/<wbr>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="gmail-m_6806243789727229603m_1191454515936963247m_-6321393146272278729m_-576177836348287723gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div></blockquote></div></div></div></div>
</blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><br><br clear="all"><div><br></div>-- <br><div class="gmail-m_6806243789727229603m_1191454515936963247gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div></div></blockquote></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><span style="font-family:Times;font-size:medium"><table cellspacing="0" cellpadding="0"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top:2px solid rgb(213,15,37)">Teresa Johnson |</td><td nowrap style="border-top:2px solid rgb(51,105,232)"> Software Engineer |</td><td nowrap style="border-top:2px solid rgb(0,153,57)"> <a href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td nowrap style="border-top:2px solid rgb(238,178,17)"> 408-460-2413</td></tr></tbody></table></span></div>
</div></div>