<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/77505>77505</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AArch64] Extra unconditional branch instruction being generated
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ceseo
</td>
</tr>
</table>
<pre>
Following up the discussion on the AArch64 Sync call (2024-01-09):
While debugging OpenMP (`ompt/synchronization/master.c`), I noticed this:
``` ce8: 91364000 add x0, x0, #0xd90
cec: 97ffff19 bl 950 <__kmpc_end_master@plt>
cf0: 14000001 b cf4 <main.omp_outlined+0xd4>
cf4: d503201f nop
cf8: 14000001 b cfc <main.omp_outlined+0xdc>
cfc: d0000088 adrp x8, 12000 <__gmon_start__@Base>
d00: f9404d08 ldr x8, [x8, #152]
```
I'd expect the `nop` to be followed by the `adrp`. Instead, there is an unconditional branch to the `adrp`.
I've seen this pattern in other parts of the code as well, but this is the example I had at hand. I can try to create a smaller reproducer, if necessary.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8lM-O4ygQxp-GXEodlfGfxAcfuqcnUg6rXWkPe4zKUI7ZxWABnkn26Vc4Tk9rNNooMomhft9XUBTFaK6OuRP1m6jfd7Sk0YdOcWS_672-dydvrf9u3BWWGdLIoE1US4zGO_BuffP6GtTYVPDn3SlQZC0IeZQoqxcsXrAVshXlq8B3gdvzr9FYBs39cr1m8u8zu9_-yFGiQT_NSchTvDs1Bu_Mv5SMd0KeJoqJw16JBjNSfoEzOJ-MYg1pNPEnkbxs_YLioyhfAaAtyqZCRNg-pPU63jDTHk8hS7zpFh8QUKxybHsYhmEo2mdkbx9jWyOI8svl8s80qws7fXm4FBXONony6xMz4MNCkfURC-g3khqqTJjIuL2f5otfkjWOtZBveNPVZ0T1QOgaS4nF8PTi_PyxZE30Q-Np9kNK_Y-U-iylNqkVdDwC6TCvO3XMe1TIvIlr3tfJu0tMFNLlIip8o8g_OBq3rIe2wkrj8enI6rChRP22_ZBlUUtRv__yDB9_z0IeNPBtZpXWyhMN5uwbhOShZxjWYmUN_f05n52LBvdwdjEx6ayVRg4MJgI5WJzyTptcY2ShD-TUmGk_hX92lW18Y4jMbi08mCklDg6MA5_ZMFNIEfywUpTXDBThO1ub1fslPcJMXOf5RtNsGc4wkgZKMJLTeziDIgcp3LMbFZgSA0GcyFoOEHgOXi-KQ0aaARwrjpHCfb_TXanbsqUdd8UBq6MsK2x3Y8eK5NCSqmrFWBS9LKjBGgtqDgcqm35nunxrscC2OGIp232JimhAPjZ1WyiqRIU8kbF7a79Nex-uOxPjwt3hUGO9s9Szjc9WErq86KVfrlFUaE1M8UdYMsmuTWfrHaJ-h6-3FOjX52FcTGFR-SX0nFvGlR0HSqx3S7DdmNK83n95EvJ0NWlc-r3yk5CnLLkNL3Pwf7PK3WW1HYU8rc7_CwAA__86PX1G">