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

    <tr>
        <th>Summary</th>
        <td>
            [OpenM] Avoid type-punning on the parallel_51 call edge
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            openmp
      </td>
    </tr>

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

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

<pre>
    We type pun firstprivate integers (among other things) on the call edge between the sequential and parallel region. This is really bad for device code as it prevents us in pretty much all pipelines to inline the parallel runtime function. If we would not type-pun it works fine. If we run another optimization pipeline, it does work too. Unsure what part of the inliner is affected here but my guess is that it's the "CallBase::getCalledFunction" checking that the callee type matches the call site.

This is a pretty bad regression we should try to fix and backport into 16.

Example: https://godbolt.org/z/9o7qMPcvM
```
#include <omp.h>
void f(long *A, int N) {
    long i = 0;
#pragma omp target map(A[ : N])
 {
#pragma omp parallel firstprivate(i)
        A[omp_get_thread_num()] = i;
    }
}
```


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcVE2TozgM_TXORdUpYgKEA4d0Z1K1h57dw27tscvYAjxtbI8tJ5P59VsmXzuTShEgetJ7erJEjHq0iB2rXll1WIlEkwvdN-UwDBho1Tt16f5FoItH8MnCoEMkH_RJEIK2hCOGCIzvxOzsCI4mDECTtmNkvAVngSYEKYwBVCNCj3RGvL6N-D2hJS0MCKvAiyCMQQMBR-3sGv6edAQdIaAw5gK9UDC4AApPWiJIpxBEBE3gA57QUoQUQdv8SHSBOckJcmGvPRptMQI50DbfLvWfBZMlPSMMyUpaSv8xwBnh7JJRYB0t-l-yfk1wduEzwqAt3uNCsiDsVbvzpGf9U-Q8j8qMv2WkchgXOJBza_jHxhQQzpOgzIXADQuvK8WQpYthQEmoYMKA0CeC-QJjwrg0hjJSE-NNXICM8zdhzKuIyMo9K_cjUn6B6nhTxjgHOaH81Ha8wu_24M3kWZCcMD5ti5pwzYoDK_bX690WcW90NibgGDDGLPqMEKelcxQuueWD_rEY3Av56V2gPDcONvUvWb_8ELM3mTdMRD5mAfzI-HF0qneG1i6MjB9_Mn5sXfP9_S95er_h6-L2vT7yUltpkkJg5Zub_Xpi5ZfrfyenFQyM70weVsb3-8UZS_A1TytrXq9xAABLiAZWHqBg5esjuQ9inAW42QOJMCLBLDzjuz2rXiHT_8qqA-PtLdMj56_Qx-z9_0AxvtNP5O2T87rZf4xIHzQFFOrDppnxXY6sDgtB_SCYEaw53Eo-bn5r0XJdqa5UbdmKFXabutk2bVWX29XU8bqSoucoq0FsNvWmkLstl5WqseF821cr3fGCl8WGN0VVFOV2PbRtWxd9X6tNLZu6ZdsCZ6HN2pjTnJ1b6RgTdnVR8mZlRI8mLjuHc-fRzp5xnvdP6DLgpU9jZNvC6EjxmYI0mWVT_enRvmfpVz_vZ9Pmmb4tnHt7P6rNc_msUjDdb8OlaUr9WrqZ8WOudPt58cF9Q0mMHxfmkfHjQv6_AAAA___EB6x1">