xref: /llvm-project/llvm/test/CodeGen/X86/win64_eh_leaf.ll (revision e29e30b1397f3e50f3487491f8a77ae08e4e3471)
1; RUN: llc < %s -O1 -mtriple=x86_64-pc-win32 | FileCheck %s -check-prefix=ASM
2; RUN: llc < %s -O1 -mtriple=x86_64-pc-win32 -filetype=obj -o %t
3; RUN: llvm-readobj --unwind %t | FileCheck %s -check-prefix=READOBJ
4
5declare void @g(i32)
6
7define i32 @not_leaf(i32) uwtable {
8entry:
9  call void @g(i32 42)
10  ret i32 42
11
12; ASM-LABEL: not_leaf:
13; ASM: .seh
14
15; READOBJ: RuntimeFunction {
16; READOBJ-NEXT: StartAddress: not_leaf
17; READOBJ-NEXT: EndAddress: not_leaf
18}
19
20define void @leaf_func(i32) uwtable {
21entry:
22  tail call void @g(i32 42)
23  ret void
24
25; A Win64 "leaf" function gets no .seh directives in the asm.
26; ASM-LABEL: leaf_func:
27; ASM-NOT: .seh
28
29; and no unwind info in the object file.
30; READOBJ-NOT: leaf_func
31}
32
33define void @naked_func() naked {
34  call void asm sideeffect "ret", ""()
35  unreachable
36}
37; ASM-LABEL: naked_func:
38; ASM-NOT: .seh_
39; ASM: ret
40; ASM-NOT: .seh_
41