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

    <tr>
        <th>Summary</th>
        <td>
            [WinEH] Missing register reload in catch funclet
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          kalle-llvm
      </td>
    </tr>
</table>

<pre>
    This code:

https://godbolt.org/z/xxoY4zhTG

is miscompiled by clang, a register is not reloaded in the catch-funclet so 'this' becomes garbage inside the catch.  I'm using 15.0.7 and I have tried different versions on godbolt.  Starting with 8.0.0 they give essentially the same code. (Versions before this give correct code, but that may just be a fluke, this bug was hard to reproduce...)

Karl-Johan Johnsson

[repro.cpp.txt](https://github.com/llvm/llvm-project/files/10743168/repro.cpp.txt)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk0FzpDYQhX-NuHQNBWKAmQOH2BMSO5VTXEnl2EINki2kKbUYe_zrt8D22ru3vUAVXe_p9eMTMtvJE3WivhH1KcMlmRC7J3SOds5d5kwFfe0ejGUYgiZR_SaKkyjenyalM6_fZC9kPwWtgkt5iJOQ_auQ_ctL-H__ah7--CqyDLPlIcxn60iDusLg0E9C3gJCpMlyogiWwYcEkVxATRqsh2QIBkyD2Y2LHxwl4ABCtslYFrIFRUOYiWHCqHAisJ6tpk9ZDnAnZDvDwtZPUNZ5kbeAXsMdGLwQpGhJg7bjSJF8ggtFtsEzBA8fywH8kzCm1eDZJgOHvMiL9YwrTPZCQMzkk0XnrtvJjDNt1eUg5OHfD0dFY4hrNstvuiHESEN6a1negloSJIMJZrzC48IJFAHC6Janbb4p1TLBMzIYjBpSgEjnGPQyUJ7nQh6_tv4XRre7DwY93AfjmYP_Ohb1zSbOh_M5Ty9J1CchDz_9X5vMovIhzEL2Kxzvr905hkcakpD9aB2xkH1ZtPuqbA5C9j_afoTKdFfpY3XEjLqyaZt90zR1nZluGNs9kkJqtDo2w_HQSKxKVY-HCketx8x2spBVIcu6rMqirvNKttiqFlHVrSwrLfYFzWhdvmZbYcws80JdU7RNkzlU5HjjXUpPz7ANhZQr_rHb9lHLxGJfOMuJP12STW67KP9Z__ufoj7B35Y3kr5D-0bryuoGHLxzmi3Rdb_c5RZsLXML_i0AAP__xKYx4A">