~sircmpwn/hare#458: 
qbe fails to optimize away stack slot for unused value

Input:

# struct { x: int, y: int, } [id: 2446476974]
type :type.3 = align 4 { w 1, w 1 }

export function section ".text.main" "ax" :type.3 $main() {
@start.0
	%rval.2 =l alloc4 8
@body.4
	%offset.5 =l add %rval.2, 0
	storew 10, %offset.5
	%offset.5 =l add %rval.2, 4
	storew 20, %offset.5
	jmp @end.1
@end.1
	ret %rval.2
}

Output:

.section ".text.main", "ax"
.globl main
main:
	pushq %rbp
	movq %rsp, %rbp
	sub $16, %rsp
	movl $10, -8(%rbp)
	movl $20, -4(%rbp)
	movq -8(%rbp), %rax
	leave
	ret
/* end function main */
Status
RESOLVED INVALID
Submitter
~sircmpwn
Assigned to
Submitted
1 year, 4 months ago
Updated
1 year, 3 months ago
Labels
bug third-party

~sircmpwn REPORTED INVALID 1 year, 3 months ago

Apparently qbe does not support dead store elimination anyway.

Register here or Log in to comment, or comment via email.