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

    <tr>
        <th>Summary</th>
        <td>
            [AArch64] cfi_negate_ra_state emitted incorrectly.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AArch64,
            regression:20
      </td>
    </tr>

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

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

<pre>
    `.cfi_negate_ra_state` is emitted before the corresponding instruction which is incorrect.
Debuggers or unwinders might not able to unwind the frames correctly.

This is a regression on the 20.x release (19.x is not affected): #137800 
revert on the mainline: #137795 


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxskkGToy4QxT9Ne6HGwkZMPHjw_0_lMte9pwBbZRchBZiZfPstXWdy2D1RVHe_H817KiU7eaIO5H-AeFHeknuPNuUwvtuUABHkpVBrnkPs_ioXOgzPDhpemtHePE0q0y2qW8oqEzSc2cRosTnTwDSNIRLLMzETYqR0D36wfmLWpxxXk23w7GO2Zt6mrN-bTC6B9xfS6zRRTCxEtvoP64ftsthpzsyHzJR2xHI4ajtjjGqhxA4V99x0gPc_5k08McUiTZFS2qjB7yPIy08WyZFKxADPVVt-br07YRzJZBoAWxA9AxSVOJ05Z8D7SA-K-UtlUdY76-nVdmol-0Mvhk4MrWhVQV11qmUreHvmxdzVlVRayKoZxfmkpW4lcc2bRjQ0SFOZwnbIUfIa2wrrtuYlGtlUWDeiqcX5NLRQc1qUdaVzj6UMcSpsSit1-zOxcEqTS4fNWplf5AcQfd9HMzf1ZjP-D4ivTwHRIz_sj90m-qbXKUHNnU05vTDZZrfn50tLXtg_0vCdg29n3bMs1ui6Oed7AtEDXgGvk83zqksTFsDrBjmOt3sMP8lkwOu-WAK8Hrs9OvwdAAD__6Cy5wo">