This fixes bug <https://github.com/llvm/llvm-project/issues/54022>. For now this means that defined functions will have two .functype directives emitted. Given discussion in that bug has suggested interest in moving towards using something other than .functype to mark the beginning of a function (which would, as a side-effect, solve this issue), this patch doesn't attempt to avoid that duplication. Some test cases that used CHECK-LABEL: foo rather than CHECK-LABEL: foo: are broken by this change. This patch updates those test cases to always have a colon at the end of the CHECK-LABEL string. Differential Revision: https://reviews.llvm.org/D122134
47 lines
1.6 KiB
LLVM
47 lines
1.6 KiB
LLVM
; RUN: llc --mtriple=wasm32-unknown-unknown -asm-verbose=false %s -o - | FileCheck --check-prefixes CHECK -DPTR=i32 %s
|
|
; RUN: llc --mtriple=wasm64-unknown-unknown -asm-verbose=false %s -o - | FileCheck --check-prefixes CHECK -DPTR=i64 %s
|
|
|
|
; empty function that does not use stack, to check WebAssemblyMCLowerPrePass
|
|
; works correctly.
|
|
define hidden void @bar() #0 {
|
|
ret void
|
|
}
|
|
|
|
; Function that uses explict stack, and should generate a reference to
|
|
; __stack_pointer, along with the corresponding relocation entry.
|
|
define hidden void @foo() #0 {
|
|
entry:
|
|
alloca i32, align 4
|
|
ret void
|
|
}
|
|
|
|
; CHECK: .text
|
|
; CHECK-NEXT: .file "stack-ptr-mclower.ll"
|
|
; CHECK-NEXT: .globaltype __stack_pointer, [[PTR]]
|
|
; CHECK-NEXT: .functype bar () -> ()
|
|
; CHECK-NEXT: .functype foo () -> ()
|
|
|
|
; CHECK-NEXT: .section .text.bar,"",@
|
|
; CHECK-NEXT: .hidden bar
|
|
; CHECK-NEXT: .globl bar
|
|
; CHECK-NEXT: .type bar,@function
|
|
; CHECK-NEXT: bar:
|
|
; CHECK-NEXT: .functype bar () -> ()
|
|
; CHECK-NEXT: end_function
|
|
; CHECK-NEXT: .Lfunc_end0:
|
|
; CHECK-NEXT: .size bar, .Lfunc_end0-bar
|
|
|
|
; CHECK: .section .text.foo,"",@
|
|
; CHECK-NEXT: .hidden foo
|
|
; CHECK-NEXT: .globl foo
|
|
; CHECK-NEXT: .type foo,@function
|
|
; CHECK-NEXT: foo:
|
|
; CHECK-NEXT: .functype foo () -> ()
|
|
; CHECK-NEXT: global.get __stack_pointer
|
|
; CHECK-NEXT: [[PTR]].const 16
|
|
; CHECK-NEXT: [[PTR]].sub
|
|
; CHECK-NEXT: drop
|
|
; CHECK-NEXT: end_function
|
|
; CHECK-NEXT: .Lfunc_end1:
|
|
; CHECK-NEXT: .size foo, .Lfunc_end1-foo
|