fix dynamic stack allocs for amd64

The arm64 might have the same problem but it
is currently unable to handle them even in
instruction selection.

Thanks to Jean Dao for reporting the bug.
This commit is contained in:
Quentin Carbonneaux 2017-07-27 19:48:54 -04:00
parent 64c79edda0
commit 2b64b75c84
4 changed files with 41 additions and 4 deletions

27
test/dynalloc.ssa Normal file
View file

@ -0,0 +1,27 @@
# make sure dynamic allocations
# and caller-save regs interact
# soundly
function $g() {
@start
ret
}
function w $f(w %arg) {
@start
call $g()
@alloc
%r =l alloc8 16
storel 180388626474, %r
%r8 =l add 8, %r
storel 180388626474, %r8
ret %arg
}
export
function w $main() {
@start
%a =w call $f(w 0)
%b =w call $f(w 0)
ret %a
}