<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/77913>77913</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [spirv] calling extern function hits assert
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          karolherbst
      </td>
    </tr>
</table>

<pre>
    Example OpenCL C code (OpenCL CTS `test_compiler simple_library_with_link`):
```c
extern __kernel void
CopyBuffer(
    __global float* src,
    __global float* dst );
__kernel void
AnotherCopyBuffer(
    __global float* src,
 __global float* dst )
{
    CopyBuffer(src, dst);
}
```

results in the following assert being hit: `/home/kherbst/git/llvm-project/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h:166: llvm::Register llvm::SPIRV::ModuleAnalysisInfo::getFuncReg(const llvm::Function*): Assertion `FuncPtrRegPair != FuncMap.end() && "Cannot find function ID"' failed.`

llvm commit: 414ea3a77181ef01d2cc2ad34950fc1c03ce0d41
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVMFu5DYM_Rr5QnQg0R57fPDBmekAAbpokF30OpBl2lYjS4YkJ5u_L2Qn3WTR9lBgIA1J6fGRfLIMQY-WqGHHO3a8ZHKNk_PNk_TOTOS7ELPO9a_Nr9_lvBiC3xey59_gDMr1BAxP745vX4GVPFKIN-XmRRvyEHS6czO689K_3l50nG5G2ydWcoY1y1vGL4y3ydx-arfpeyRv4XZ7Im_JwLPT_R45u-X1bh0G8gxPuwsA4HYbjeukgcE4GRm2ELxieP6vE32IsJG420_9Q7bWujiR_39J_z3jXnN19wPqU4YdJZ3-SI9Vl5-a9WZuq6ewmhhAW4gTweCMcS_ajiBDIB-ho2RMOrK8ha3718nNxPD6tA-Z4XXUaTXmef5l8e5PUu9m2nTH8PpN-pGS9-vD_eMf7_sX16-GWivNa9DhMLG8FWWZEm2X85bl7SONOkTyH1w7xvb3M8K9HdzuHyleV6seaWR4Us6G-OF-ikTtLMN21xK0W63a2VRhCj9E_0jjg9QeGAqWXyB5v8jlQLZPs8QaGJYMS2CIZ2mtizBo28PwBg73F4bIsIJBakP94ae-Jzqg3DzvnS1EQTKXVSVOggYuelQKZZ8X9ZEPSiieK-J9IbK-yfs6r2VGjaj4kZeY8yKbmrqsB0FVUQySRCmoo64cUPC6JMFPNWa6QY4FFwIF4pEXBzpRflLHHhWpoewLVnCapTaHRO3g_JjpEFZqqqoWeWZkRyZsbx3R0gtswVTi8ZL5Zht-t46BFdzoEMMPlKij2T4SYdH-mR0voKQxSVVvr_Xvlk06hjfdZas3zRTjEtLM8LqrbFq7g3LzB3V91tzGKTC8bpz_CgAA___Nl24d">