<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/104032>104032</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AVR] Ran out of registers during register allocation
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AVR,
crash-on-valid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
aykevl
</td>
</tr>
</table>
<pre>
I have the following IR, reduced from a much bigger test case (which would presumably also crash in a real program):
```llvm
target datalayout = "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8"
target triple = "avr"
declare ptr @bar() addrspace(1)
declare void @baz() addrspace(1)
define void @foo(ptr %arg) addrspace(1) {
entry:
%val = call addrspace(1) ptr @bar()
%gep1 = getelementptr { i8, i8, ptr }, ptr %val, i32 0, i32 1
%gep2 = getelementptr { i8, i8, ptr }, ptr %val, i32 0, i32 2
%gep3 = getelementptr { i8, i8, ptr }, ptr %arg, i32 0, i32 2
call addrspace(1) void @baz()
store i8 0, ptr %gep1, align 1
store ptr %gep2, ptr %arg, align 1
store ptr null, ptr %gep3, align 1
ret void
}
```
Compiling it, I get the following error:
```
$ llc -filetype=obj -o reduced.o reduced.ll
error: ran out of registers during register allocation
```
This happens with both LLVM 18.1.6 and with a recent LLVM (4377656f2419a8eb18c01e86929b689dcf22b5d6).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVVFvqzgT_TXmZURkxkDMAw9to0qV7id9qlb33eABfK-DkW1SZX_9CkiazW272l2tFNkee84ZZjw-USGYfiSqWfHIikOi5jg4X6vzTzrZpHH6XL_AoE4EcSDonLXuzYw9vLwyfAJPem5JQ-fdERQc53aAxvQ9eYgUIrQqEDCUb4NpB3hzs9UweQrzUTX2DMoGB61XYQAzggJPysLkXe_VkWHFxAPjB8avY8m3n7Wn47YVle8pglZRWXV2cwQmDsAQKf1_lk5MPGQlEw8yNXKbrqbAbS7zde4udnexR5mqZcEQ7wJFbyZL1yDq5N8dtlFTa5UnmKIHlvNGeYaSYQVKax8m1RJDmS2pfQI6OaM31O9_C9WZ8QbqnGMo17hYKN9_Bge2f9zANEZ_fi_vAjkpu6bVKms_An_N54JbgD1N2YrsKZKlI41x9d4_gpFLj2zjtnd4X64R12OBwK-L7J4Y_zNivCcW_4p4LetXxJ8X7sOdXt1DdJ7AyI3pEmCp5WIqa_rxVozN9-aDH7_pS8Q4W3sfQXzi7ymun3ppsP3hlxf358Z7csfJ2EUDTFyoXmB9GXfqQN47_9XzvZiYg7UtpJ2xFM8TMXFwzQ9I3VVVdreVtZe-vfCCVyMsz9114Kk3IZIPoGe_BL9ugLLWtSoaN_5FOr8NJsCgponGAG8mDtC4OMC3b9__B5ncZbsS1Ki3k0WhWhrjdspQ5mK_L4uywzyrlKQmky3PSJYVVk0pK912iE2hS4bVLtG10JWoVEJ1tkdR5mVV8mSoRckFCtlVDS863knRVHKvu1LyTmeNlompkWPOZZZneV4h31HXdjnP97LYFxVRw3JOR2XsblHGnfN9YkKYqc54zgUmVjVkw6rwiI1qf9KomXh4-P66yBc-McRVhFM3pidljV62i0Pi64UvbeY-sJxbE2K4RYgm2vVfY6EpDvD6z24kmb2thxinsLQJPjN87k0c5mbXuiPD51XjtymdvPtBbWT4vKYVGD5fMjvV-EcAAAD__4jO-X0">