File: win64-eh-unwindv2-too-many-epilogs.mir

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (94 lines) | stat: -rw-r--r-- 3,196 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Require V2 and restrict the number of unwind codes to 8
# RUN: not llc -mtriple=x86_64-pc-windows-msvc -o - %s \
# RUN:    -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-max-unwind-codes=8 \
# RUN:    2>&1 | FileCheck %s -check-prefix=REQUIREV2

# Force best-effort and restrict the number of unwind codes to 8
# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %s \
# RUN:    -run-pass=x86-wineh-unwindv2 -x86-wineh-unwindv2-max-unwind-codes=8 \
# RUN:    -x86-wineh-unwindv2-force-mode=1 | \
# RUN:    FileCheck %s -check-prefix=BESTEFFORT

# Require V2, but allow the default number of unwind codes (255)
# RUN: llc -mtriple=x86_64-pc-windows-msvc -o - %s \
# RUN:    -run-pass=x86-wineh-unwindv2 | FileCheck %s -check-prefix=ALLOWMORE

# Usually 255 unwind codes are permitted, but we passed an arg to llc to limit
# it to 8.
# REQUIREV2: error: example.c:2:1: Windows x64 Unwind v2 is required, but the function 'too_many_epilogs' has too many unwind codes.
# REQUIREV2-SAME: Try splitting the function or reducing the number of places where it exits early with a tail call.

# If we force "best effort" mode, then we won't see any errors, but we won't use
# v2.
# BESTEFFORT-NOT: SEH_UnwindVersion
# BESTEFFORT-NOT: SEH_UnwindV2Start

# If we allow more epilogs then too_many_epilogs will compile with v2.
# ALLOWMORE-LABEL: too_many_epilogs
# ALLOWMORE: SEH_UnwindVersion 2
# ALLOWMORE: SEH_UnwindV2Start

--- |
  define dso_local void @too_many_epilogs() local_unnamed_addr !dbg !9 {
  entry:
    ret void, !dbg !10
  }

  !llvm.dbg.cu = !{!0}
  !llvm.module.flags = !{!2, !3, !4, !5}

  !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
  !1 = !DIFile(filename: "/app/example.c", directory: "/app")
  !2 = !{i32 1, !"winx64-eh-unwindv2", i32 2}
  !3 = !{i32 7, !"Dwarf Version", i32 4}
  !4 = !{i32 2, !"CodeView", i32 1}
  !5 = !{i32 2, !"Debug Info Version", i32 3}
  !6 = !DIFile(filename: "example.c", directory: "/app")
  !7 = !DISubroutineType(types: !8)
  !8 = !{null}
  !9 = distinct !DISubprogram(name: "too_many_epilogs", scope: !6, file: !6, line: 1, type: !7, scopeLine: 2, spFlags: DISPFlagDefinition, unit: !0)
  !10 = !DILocation(line: 2, column: 1, scope: !9)
  !11 = !DILocation(line: 3, column: 1, scope: !9)
...
---
name:            too_many_epilogs
body:             |
  bb.0.entry:
    frame-setup SEH_EndPrologue
    SEH_BeginEpilogue
    SEH_EndEpilogue
    RET64 debug-location !10
  bb.1:
    SEH_BeginEpilogue
    SEH_EndEpilogue
    RET64 debug-location !11
  bb.2:
    SEH_BeginEpilogue
    SEH_EndEpilogue
    RET64 debug-location !11
  bb.3:
    SEH_BeginEpilogue
    SEH_EndEpilogue
    RET64 debug-location !11
  bb.4:
    SEH_BeginEpilogue
    SEH_EndEpilogue
    RET64 debug-location !11
  bb.5:
    SEH_BeginEpilogue
    SEH_EndEpilogue
    RET64 debug-location !11
  bb.6:
    SEH_BeginEpilogue
    SEH_EndEpilogue
    RET64 debug-location !11
  bb.7:
    SEH_BeginEpilogue
    SEH_EndEpilogue
    RET64 debug-location !11
  bb.8:
    SEH_BeginEpilogue
    SEH_EndEpilogue
    RET64 debug-location !11

...