aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/WinEH/wineh-dynamic-alloca.ll
blob: aee1838445c56baca73a17d9cabfc97137548179 (plain)
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
95
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s | FileCheck %s
target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32-a:0:32-S32"
target triple = "i386-pc-windows-msvc"

%struct.Foo = type { i32, i32 }

@bar = external global i1

define dso_local noundef i32 @foo() local_unnamed_addr #0 personality ptr @__CxxFrameHandler3 {
; CHECK-LABEL: foo:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    pushl %ebp
; CHECK-NEXT:    movl %esp, %ebp
; CHECK-NEXT:    pushl %ebx
; CHECK-NEXT:    pushl %edi
; CHECK-NEXT:    pushl %esi
; CHECK-NEXT:    subl $16, %esp
; CHECK-NEXT:    movl %esp, -28(%ebp)
; CHECK-NEXT:    movl $-1, -16(%ebp)
; CHECK-NEXT:    leal -24(%ebp), %eax
; CHECK-NEXT:    movl $___ehhandler$foo, -20(%ebp)
; CHECK-NEXT:    movl %fs:0, %ecx
; CHECK-NEXT:    movl %ecx, -24(%ebp)
; CHECK-NEXT:    movl %eax, %fs:0
; CHECK-NEXT:    cmpb $1, _bar
; CHECK-NEXT:    je LBB0_1
; CHECK-NEXT:  LBB0_5: # %exit
; CHECK-NEXT:  $ehgcr_0_5:
; CHECK-NEXT:    movl -24(%ebp), %eax
; CHECK-NEXT:    movl %eax, %fs:0
; CHECK-NEXT:    xorl %eax, %eax
; CHECK-NEXT:    leal -12(%ebp), %esp
; CHECK-NEXT:    popl %esi
; CHECK-NEXT:    popl %edi
; CHECK-NEXT:    popl %ebx
; CHECK-NEXT:    popl %ebp
; CHECK-NEXT:    retl
; CHECK-NEXT:  LBB0_1: # %if.then
; CHECK-NEXT:    pushl %eax
; CHECK-NEXT:    pushl %eax
; CHECK-NEXT:    movl %esp, %eax
; CHECK-NEXT:    movl %esp, -28(%ebp)
; CHECK-NEXT:    movl $123, (%eax)
; CHECK-NEXT:    movl $0, -16(%ebp)
; CHECK-NEXT:    calll _alwaysthrows
; CHECK-NEXT:  # %bb.4: # %unreachable.i
; CHECK-NEXT:  LBB0_3: # Block address taken
; CHECK-NEXT:    # %catch.i
; CHECK-NEXT:    addl $12, %ebp
; CHECK-NEXT:    jmp LBB0_5
; CHECK-NEXT:    .def "?catch$2@?0?foo@4HA";
; CHECK-NEXT:    .scl 3;
; CHECK-NEXT:    .type 32;
; CHECK-NEXT:    .endef
; CHECK-NEXT:    .p2align 4
; CHECK-NEXT:  "?catch$2@?0?foo@4HA":
; CHECK-NEXT:  LBB0_2: # %catch.i
; CHECK-NEXT:    pushl %ebp
; CHECK-NEXT:    addl $12, %ebp
; CHECK-NEXT:    movl %esp, -28(%ebp)
; CHECK-NEXT:    movl $LBB0_3, %eax
; CHECK-NEXT:    popl %ebp
; CHECK-NEXT:    retl # CATCHRET
; CHECK-NEXT:  Lfunc_end0:
entry:
  %cmp = load i1, ptr @bar
  br i1 %cmp, label %if.then, label %exit

if.then:                                          ; preds = %entry
  %foo = alloca <{ %struct.Foo }>, align 4
  store i32 123, ptr %foo, align 4
  invoke void @alwaysthrows() #1
          to label %unreachable.i unwind label %catch.dispatch.i

catch.dispatch.i:                                 ; preds = %if.then
  %3 = catchswitch within none [label %catch.i] unwind to caller

catch.i:                                          ; preds = %catch.dispatch.i
  %4 = catchpad within %3 [ptr null, i32 64, ptr null]
  catchret from %4 to label %exit

unreachable.i:                                    ; preds = %if.then
  unreachable

exit:                                             ; preds = %entry, %catch.i
  ret i32 0
}

declare dso_local i32 @__CxxFrameHandler3(...)

declare dso_local void @alwaysthrows() local_unnamed_addr

attributes #0 = { norecurse "min-legal-vector-width"="0" "target-cpu"="pentium4" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noreturn }