Closed shepmaster closed 8 years ago
Reduced testcase:
define void @foo(i64*, i64) {
%remainder = srem i64 0, %1
store i64 %remainder, i64* %0, align 1
ret void
}
Added to test/CodeGen/AVR/calling-conv-assertion.ll
in 5d82a2734281af8484d6c76fd32e2891c7ac3fc6.
Ok, so the error message means that the result of a function call (specifically index 4
) of type i16
could not be fit within the calling convention. There are actually 8 values to be returned of type i16
, and only 4 register pairs available: R25R24
, R23R22
, R21R20
, R19R18
.
Slightly smaller:
define i64 @foo(i64) {
%remainder = srem i64 0, %0
ret i64 %remainder
}
An interesting thing is that the version that returns a void
has this issue. Since it's deliberately storing into a pointer, I wouldn't expect there to be any issue here...
Tracking more debugging, it appears to be happening because of the sdivrem
call specifically, as it would return i64, i64
, which corresponds to the 8xi16
spots.
Could you check what the calling convention is? C
, AVR_BUILTIN
, etc.
The calling convention is 0
, which should be C
. At this line, it's using the RetCC_AVR
set.
Fixed in #194
Running
llc -march=avr -mcpu=atmega328p -filetype=obj bugpoint-reduced-simplified.ll
on: