<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - Assertion "mapping to a source type"' failed"
   href="https://llvm.org/bugs/show_bug.cgi?id=30799">30799</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion "mapping to a source type"' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, nicolasweber@gmx.de, peter@pcc.me.uk, rnk@google.com, ruiu@google.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When using lld to do an LTO build of Chrome on Windows, I hit this assert:

lld-link: ../lib/Linker/IRMover.cpp:283: llvm::Type*
{anonymous}::TypeMapTy::get(llvm::Type*, llvm::SmallPtrSet<llvm::StructType*,
8u>&): Assertion `!(Pair.first != Ty && Pair.second == Ty) && "mapping to a
source type"' failed.


Still not sure what's going on, but dumping my notes so far.

The linker has already loaded and linked a bunch of bitcode into a module M1,
and now we're trying to add another one, M2.

The assert fires during IRLinker::computeTypeMapping()

It's trying to map a type in M2 (Src) to one in M1 (Dst).

The type the assert is firing when trying to map from this type in M2 to a type
in M1.

%struct.MojoHandleSignalsState = type { i32, i32 }


Now, the mystery is that this type doesn't originally exist in M2.

If I create a new Context, read M2 and dump it, there's no mention of
%struct.MojoHandleSignalsState.

However, if I create a new Context, read M1, then read M2 afterwards and dump
M2, suddenly the type is there!

Trying to trace where the type comes from, it appears to be used in a
ConstantAsMetadata object (but again, only if M1 has been read into the context
first).


Types from M1 seem to be leaking over to M2 via the Context in some way I don't
understand..

Any ideas for how to debug this would be appreciated.</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>