| Issue |
234929
|
| Summary |
[AVR] llc aborts with "Attempting to emit STDPtrQRr" on AVRTiny cores
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
petar-jovanovic
|
On AVRTiny cores, `llc` aborts in the AsmPrinter when a function spills an 8-bit value, or when a function without a frame pointer (or with a variable-sized `alloca`) passes a byte on the stack:
```
LLVM ERROR: Attempting to emit STDPtrQRr instruction but the Feature_HasNonTinyEncoding predicate(s) are not met
```
Every register allocator is affected, including the default one, and at `-O0` a function with a single branch is enough.
## Reproducers
```llvm
declare void @foo()
declare void @bar(i8, i8, i8)
; Three bytes are live across the call, so one is spilled.
define void @spill(i8 %a, i8 %b, i8 %c) {
call void @foo()
call void @bar(i8 %a, i8 %b, i8 %c)
ret void
}
```
```llvm
declare void @baz(i32, i16, i8)
; The i8 is passed on the stack.
define void @stack_arg(i8 %x) {
call void @baz(i32 0, i16 0, i8 %x)
ret void
}
```
```
llc -mtriple=avr -mcpu=attiny10 repro.ll -o /dev/null
```
Both fail at `-O0` and `-O2`. `llvm/test/CodeGen/AVR/cmp.ll` also fails with `-mcpu=attiny10 -regalloc=fast`.
## Notes
- Affected: `attiny4`, `attiny5`, `attiny9`, `attiny10`, `attiny20`, `attiny40`, `attiny102`, `attiny104` and `-mcpu=avrtiny`. Cores with the full instruction set (e.g. `atmega328p`, `avr2`) are fine.
- Builds without assertions do not abort; they silently emit `std`/`ldd` (e.g. `std Z+1, r24`), which these cores do not support.
- `attiny11` fails differently (`PUSHRr`, `Feature_HasSRAM`); that is a separate issue.
- Not a duplicate of #181504.
Reproduced on `main` at a39dccbd33e3.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs