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

    <tr>
        <th>Summary</th>
        <td>
            Devirtualization seem to not work properly when non-virtual interface is used
        </td>
    </tr>

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

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

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

<pre>
    Code example: https://godbolt.org/z/5h7ox47E3

Explanation.
I wanted to refactor one of our interfaces to add some checks (in debug mode).
For that I did a change that is in principle equivalent to rewriting `Intf1` to `Intf2`.
Unfortunately it caused a perf regression and turned out that now for pointers to `Intf2` when they are statically casted to the implementation type the call is no longer looks like a static call.
Moreover the behaviour also depends somehow on how the object is passed to the funcion (see the difference between `h` and `j`.

So the short-term question is do we have any way to "trick" the compiler into producing static call with inlining.
For the long term I think it would be cool to have same behaviour for `Intf2` out of the box.

Thanks.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxclMGSozgMhp_Guag6RQwhyYFD7_akqg972t0HMLYAT4zE2CJ05umnDKnqnrlAYWRJ__fLNin5nhAbdfxLHd92ZpaBY0Pe3rwY2bXsHs3f7BDww4xTQFW-wiAyJVW-Kn1V-tqzaznInmOv9PWn0tfjcOKP6vStVMWbKl6357ePKRgy4pn228o7LIYEHQhDxM5Y4QhMCNwBzxE8CcbOWEw5wjgHiUcEO6C9JVD67AkctnMPIztU-vLMe-UIMhiBd3DegQE7GOpxW_MJPMEUPVk_BQT8Mfu7CUiytbFEL556UHXxTtIdVF3kH89PreriWeV_6jjKTEYwPMALWDMnzOUmjB1E7COm5JnAkAOZI6EDnmVrg3iBjiNMvKpMf9SAZUACGfABJiIkMeKtCeEB1qQnMhkQfLZkRJKVK8hjwnU9x2apxBCYeowQmG8Jgr8hmGe-Neqp5h-OyHeM6-4WB3P32QITEoPDCcmllf7ACzBBfuVIbr-jXaFOJqXPvrqZbG5I6XPCrSXnuw4jks35ZUGkLHjIYjMgVRffP-Fuz3-3ZGngKC-CcYQfM6ZVqU_gGBaEwdwRDD1gMY8VotYSvb0prTcSPE4-4DpNDFNkN9vs7xcEsHgZwFPw5Kn_bYhwxQdr7XeQwdMtW73wHBy0OTuHXHXtIpnxK7ts71dLs_fcbYD54zeh_w2Gbmm_c03pLuXF7LA5nA6Xc11XVbUbGntuTevqk23d2RWn0_FQltZ1WJ8PtqoP9c43utBVcSoOuqiKqtqXxwtWLbbHAk_tpS5VVeBofNiHcB_zUd35lGZsLqeyqnbBtBjSegdoTbjA-lNpna-E2OQ9L-3cJ1UVwSdJn1nES8DmDe8-ymyC_7kNYkIcMxfiDCveMvgJY3hsg01ML88dn6c8e5pP0G6OofnjivEyzO3e8qj0Ndd-vl6myHkAlb6uHSelr5uie6N_BQAA__9d86Qe">