<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - AssemblyWriter::printModuleSummaryIndex(): Assertion `ModPath.second.first < moduleVec.size()' failed."
   href="https://bugs.llvm.org/show_bug.cgi?id=37899">37899</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AssemblyWriter::printModuleSummaryIndex(): Assertion `ModPath.second.first < moduleVec.size()' failed.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Core LLVM classes
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>vlad@tsyrklevich.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, tejohnson@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If you make the following change to always dump ImportSummary in the backends:
$ git diff -U1
diff --git a/lib/Transforms/IPO/PassManagerBuilder.cpp
b/lib/Transforms/IPO/PassManagerBuilder.cpp
index a2559bc70b..91eb46ed3e 100644
--- a/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -886,4 +886,6 @@ void PassManagerBuilder::addLateLTOOptimizationPasses(

+#include "llvm/IR/ModuleSummaryIndex.h"
 void PassManagerBuilder::populateThinLTOPassManager(
     legacy::PassManagerBase &PM) {
+  if (ImportSummary) ImportSummary->dump();
   PerformThinLTO = true;

You will hit the titled exception with test/LTO/Resolution/X86/mod-asm-used.ll

>From a brief look it looks like mod-asm-used.ll only has some inline assembly
and doesn't generate a summary, when the printModuleSummaryIndex() is reached
it has the following summary:
^0 = module: (path: "", hash: (0, 0, 0, 0, 0))
^1 = module: (path: "/test/LTO/Resolution/X86/Output/mod-asm-used.ll.tmp2.bc",
hash: (0, 0, 0, 0, 0))
^1 = gv: (name: "foo", summaries: (variable: (module: ^1, flags: (linkage:
external, notEligibleToImport: 0, live: 1, dsoLocal: 1)))) ; guid =
6699318081062747564

TheIndex->modulePaths().size() returns 1 but the ModPath.second.first value in
the loop is 1 not 0. Not familiar with how aggregation of summaries is
performed; however, note that ^1 occurs twice above, that seems like it might
also have to do with this bug?</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>