<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/117757>117757</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[llc] incorrect stackmap generated for arm64
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lzheng5
</td>
</tr>
</table>
<pre>
Hello,
We believe the following generated stackmap for the attached case is wrong. This only happens on arm64. x64 is correct.
Please refer to https://llvm.org/docs/StackMaps.html#stackmap-format.
```
uint8 : Register | Direct | Indirect | Constant | ConstantIndex
uint8 : Reserved (expected to be 0)
uint16 : Location Size
uint16 : Dwarf RegNum
uint16 : Reserved (expected to be 0)
int32 : Offset or SmallConstant
```
[bad]
```
Ltmp9-_next_criticals967_code7BCE
.byte 3 # Indirect
.byte 0
.short 8
.short 19 # RegNum (wrong)
.short 0
.long 56 # Offset (wrong)
```
[good]
```
Ltmp9-_next_criticals967_code7BCE
.byte 3 # Indirect
.byte 0
.short 8
.short 29 # RegNum (correct)
.short 0
.long -56 # Offset (correct)
```
`r29` should the frame register on arm64. And the offset should be negative.
```
llc --version
LLVM (http://llvm.org/):
LLVM version 17.0.2
Optimized build.
Default target: arm64-apple-darwin23.6.0
Host CPU: apple-m1
```
Thanks,
Ling
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEVE2P2zYQ_TX0ZWBBor6sgw6OXSMBNk3QTdvjgqJGEhuKFEjK3t1fX5DS1lk7QHsrIMAezbzheyPOY9aKXiHWJP9A8uOGzW7QppavA6o-3zS6fak_opSa0AOJ9yTe_4nQoBR4RnADQqel1BeheuhRoWEOW7CO8e8jm6DTJhQx5xgfsAXOLIKwcDFa9RF8G4QFreQLDGyaUPkAmBmLLILnIvOVXBuD3EWwnP5Vom9hsEMDTsPg3GRJuif0ROhJyvMYadMTemo1t4SeHj2Vz2yy0eBGSWj6xm3baTMy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