summary refs log tree commit diff
path: root/test/mem2.ssa
blob: 4a136b494798966d1006abcb6f6a80a4fa336678 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Ember Sawady reported this bug
# in stack-slot coalescing

type :t = { w 2 }

function :t $func() {
@start.0
	%temp =l alloc4 4
	%ret =l alloc4 8
	storew 1, %temp
	# storew can also go here
	%field =l add %ret, 4
	storew 2, %ret
	blit %temp, %field, 4
	# removing either of these storews causes it to work
	storew 2, %ret
	ret %ret
}

export function w $main() {
@start
	%ret =:t call $func()
	%fptr =l add %ret, 4
	%field =w loaduw %fptr
	%x =w ceqw %field, 1
	jnz %x, @passed, @failed
@failed
	# this fails despite 1 => temp => ret + 4 => field
	call $abort()
@passed
	ret 0
}