llvm-project
llvm-project copied to clipboard
The stack slot position does not match the ABI.
In link-unlink.ll, the position of the local variables completely deviate from where they should be on the stack.
To name a few, take line 20 for example, this assembly is the counterpart of the IR on line 78, which should be at (-24, %a6).
@llvm/issue-subscribers-backend-m68k
Here is the simplified version:
define i32 @foo(i32 %a) {
entry:
%ptr = alloca [2 x i32]
%0 = getelementptr [2 x i32], ptr %ptr, i32 1
store i32 %a, ptr %0
ret i32 0
}
$ llc -mtriple=m68k-linux-gnu -o - test.ll -frame-pointer=all
.text
.file "test.ll"
.globl foo ; -- Begin function foo
.p2align 1
.type foo,@function
foo: ; @foo
.cfi_startproc
; %bb.0: ; %entry
link.w %a6, #-8
.cfi_def_cfa_offset -8
.cfi_offset %a6, -8
.cfi_def_cfa_register %a6
move.l (8,%a6), (0,%a6)
move.l #0, %d0
unlk %a6
rts
.Lfunc_end0:
.size foo, .Lfunc_end0-foo
.cfi_endproc
; -- End function
.section ".note.GNU-stack","",@progbits
move.l (8,%a6), (0,%a6) is incorrect, should be move.l (8,%a6), (-8,%a6) or move.l (8,%a6), (0,%sp)
Candidate patch : D132007
closed by 721a128bb36598967