llvm-project/llvm/test/CodeGen/AVR
Ayke van Laethem 5aa8014ca8
[AVR] Remove faulty stack pushing behavior
An instruction like this will need to allocate some stack space for the
last parameter:

  %x = call addrspace(1) i16 @bar(i64 undef, i64 undef, i16 undef, i16 0)

This worked fine when passing an actual value (in this case 0). However,
when passing undef, no value was pushed to the stack and therefore no
push instructions were created. This caused an unbalanced stack leading
to interesting results.

This commit fixes that by replacing the push logic with a regular stack
adjustment and stack-relative load/stores. This is less efficient but at
least it correctly compiles the code.

I can think of a few improvements in the future:

  * The stack should have been adjusted in the function prologue when
    there are no allocas in the function.
  * Many (if not most) stack adjustments can be replaced by
    pushing/popping the values directly. Exactly like the previous code
    attempted but didn't do correctly.
  * Small stack adjustments can be done more efficiently with a few
    push/pop instructions (pushing/popping bogus values), both for code
    size and for speed.

All in all, as long as there are no allocas in the function I think that
it is almost always more efficient to emit regular push/pop
instructions. This is however left for future optimizations.

Differential Revision: https://reviews.llvm.org/D78581
2020-06-16 13:53:32 +02:00
..
atomics
calling-conv/c [AVR] Fix stack size in functions with a frame pointer 2020-06-16 13:53:32 +02:00
features [AVR] Fix I/O instructions on XMEGA 2020-05-17 19:46:09 +12:00
inline-asm
integration [AVR] Fix private label prefix 2020-02-26 20:32:25 +01:00
intrinsics
pseudo [AVR] Fix incorrect register state for LDRdPtr 2020-03-03 17:34:54 +08:00
relax-mem
PR31344.ll
PR31345.ll
PR37143.ll [AVR] Fix incorrect register state for LDRdPtr 2020-03-03 17:34:54 +08:00
add.ll
alloca.ll
and.ll
avr-rust-issue-123.ll
branch-relaxation-long.ll [AVR] Fix private label prefix 2020-02-26 20:32:25 +01:00
branch-relaxation.ll [AVR] Fix private label prefix 2020-02-26 20:32:25 +01:00
brind.ll [AVR] Fix incorrect register state for LDRdPtr 2020-03-03 17:34:54 +08:00
call.ll [AVR] Remove faulty stack pushing behavior 2020-06-16 13:53:32 +02:00
clear-bss.ll
cmp.ll
com.ll
copy-data-to-ram.ll
ctlz.ll [AVR] Fix private label prefix 2020-02-26 20:32:25 +01:00
ctpop.ll
cttz.ll [AVR] Fix private label prefix 2020-02-26 20:32:25 +01:00
directmem.ll
div.ll [AVR] Do not use divmod calls for bigger integers 2020-04-20 13:56:38 +02:00
dynalloca.ll [AVR] Remove faulty stack pushing behavior 2020-06-16 13:53:32 +02:00
eor.ll
expand-integer-failure.ll
frame.ll
frmidx-iterator-bug.ll
hardware-mul.ll
high-pressure-on-ptrregs.ll
icall-func-pointer-correct-addr-space.ll Infer alignment of unmarked loads in IR/bitcode parsing. 2020-05-14 13:03:50 -07:00
impossible-reg-to-reg-copy.ll
interrupts.ll [AVR] Generalize the previous interrupt bugfix to signal handlers too 2020-03-31 19:33:34 +13:00
io.ll
issue-cannot-select-bswap.ll
issue-regalloc-stackframe-folding-earlyclobber.ll
large-return-size.ll
lit.local.cfg
load.ll [AVR] Fix incorrect register state for LDRdPtr 2020-03-03 17:34:54 +08:00
lower-formal-args-struct-return.ll
lower-formal-arguments-assertion.ll
neg.ll
no-print-operand-twice.ll
or.ll
pre-schedule.ll
progmem-extended.ll
progmem.ll
rem.ll
return.ll [AVR] Fix stack size in functions with a frame pointer 2020-06-16 13:53:32 +02:00
rot.ll [AVR] Fix private label prefix 2020-02-26 20:32:25 +01:00
runtime-trig.ll
rust-avr-bug-37.ll Infer alignment of unmarked loads in IR/bitcode parsing. 2020-05-14 13:03:50 -07:00
rust-avr-bug-95.ll Infer alignment of unmarked loads in IR/bitcode parsing. 2020-05-14 13:03:50 -07:00
rust-avr-bug-99.ll
rust-avr-bug-112.ll
sections.ll [AVR] Do not place functions in .progmem.data 2020-04-20 13:56:38 +02:00
select-must-add-unconditional-jump.ll
sext.ll
shift.ll
sign-extension.ll
smul-with-overflow.ll [AVR] Fix private label prefix 2020-02-26 20:32:25 +01:00
software-mul.ll
std-ldd-immediate-overflow.ll
store-undef.ll
store.ll
sub.ll
trunc.ll
umul-with-overflow.ll [AVR] Fix private label prefix 2020-02-26 20:32:25 +01:00
umul.with.overflow.i16-bug.ll
unaligned-atomic-loads.ll
varargs.ll [AVR] Remove faulty stack pushing behavior 2020-06-16 13:53:32 +02:00
xor.ll
zext.ll