[llvm] [wasm] Disallow tail calls when passing structs on the stack (PR #124443)
Timothy Herchen via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 25 20:59:52 PST 2025
anematode wrote:
This test fails:
```
declare i32 @quux(ptr byval(i32))
define i32 @mismatched_byval(ptr %x) {
; CHECK-LABEL: mismatched_byval:
; CHECK: .functype mismatched_byval (i32) -> (i32)
; CHECK-NEXT: # %bb.0:
; CHECK-NEXT: global.get $push1=, __stack_pointer
; CHECK-NEXT: i32.const $push2=, 16
; CHECK-NEXT: i32.sub $push8=, $pop1, $pop2
; CHECK-NEXT: local.tee $push7=, $1=, $pop8
; CHECK-NEXT: global.set __stack_pointer, $pop7
; CHECK-NEXT: i32.load $push0=, 0($0)
; CHECK-NEXT: i32.store 12($1), $pop0
; CHECK-NEXT: i32.const $push3=, 16
; CHECK-NEXT: i32.add $push4=, $1, $pop3
; CHECK-NEXT: global.set __stack_pointer, $pop4
; CHECK-NEXT: i32.const $push5=, 12
; CHECK-NEXT: i32.add $push6=, $1, $pop5
; CHECK-NEXT: return_call quux, $pop6
%v = tail call i32 @quux(ptr byval(i32) %x)
ret i32 %v
}
```
but it's not clear to me that the test is compiled correctly in the first place. Isn't this calling quux with a pointer to (sp - 4)?
https://github.com/llvm/llvm-project/pull/124443
More information about the llvm-commits
mailing list