xref: /llvm-project/llvm/test/CodeGen/WinEH/wineh-dynamic-alloca.ll (revision 926a71f0c9ff11a7b07231439505808780e88fe5)
1*926a71f0SMirko; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2*926a71f0SMirko; RUN: llc < %s | FileCheck %s
3*926a71f0SMirkotarget 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"
4*926a71f0SMirkotarget triple = "i386-pc-windows-msvc"
5*926a71f0SMirko
6*926a71f0SMirko%struct.Foo = type { i32, i32 }
7*926a71f0SMirko
8*926a71f0SMirko@bar = external global i1
9*926a71f0SMirko
10*926a71f0SMirkodefine dso_local noundef i32 @foo() local_unnamed_addr #0 personality ptr @__CxxFrameHandler3 {
11*926a71f0SMirko; CHECK-LABEL: foo:
12*926a71f0SMirko; CHECK:       # %bb.0: # %entry
13*926a71f0SMirko; CHECK-NEXT:    pushl %ebp
14*926a71f0SMirko; CHECK-NEXT:    movl %esp, %ebp
15*926a71f0SMirko; CHECK-NEXT:    pushl %ebx
16*926a71f0SMirko; CHECK-NEXT:    pushl %edi
17*926a71f0SMirko; CHECK-NEXT:    pushl %esi
18*926a71f0SMirko; CHECK-NEXT:    subl $16, %esp
19*926a71f0SMirko; CHECK-NEXT:    movl %esp, -28(%ebp)
20*926a71f0SMirko; CHECK-NEXT:    movl $-1, -16(%ebp)
21*926a71f0SMirko; CHECK-NEXT:    leal -24(%ebp), %eax
22*926a71f0SMirko; CHECK-NEXT:    movl $___ehhandler$foo, -20(%ebp)
23*926a71f0SMirko; CHECK-NEXT:    movl %fs:0, %ecx
24*926a71f0SMirko; CHECK-NEXT:    movl %ecx, -24(%ebp)
25*926a71f0SMirko; CHECK-NEXT:    movl %eax, %fs:0
26*926a71f0SMirko; CHECK-NEXT:    cmpb $1, _bar
27*926a71f0SMirko; CHECK-NEXT:    je LBB0_1
28*926a71f0SMirko; CHECK-NEXT:  LBB0_5: # %exit
29*926a71f0SMirko; CHECK-NEXT:  $ehgcr_0_5:
30*926a71f0SMirko; CHECK-NEXT:    movl -24(%ebp), %eax
31*926a71f0SMirko; CHECK-NEXT:    movl %eax, %fs:0
32*926a71f0SMirko; CHECK-NEXT:    xorl %eax, %eax
33*926a71f0SMirko; CHECK-NEXT:    leal -12(%ebp), %esp
34*926a71f0SMirko; CHECK-NEXT:    popl %esi
35*926a71f0SMirko; CHECK-NEXT:    popl %edi
36*926a71f0SMirko; CHECK-NEXT:    popl %ebx
37*926a71f0SMirko; CHECK-NEXT:    popl %ebp
38*926a71f0SMirko; CHECK-NEXT:    retl
39*926a71f0SMirko; CHECK-NEXT:  LBB0_1: # %if.then
40*926a71f0SMirko; CHECK-NEXT:    pushl %eax
41*926a71f0SMirko; CHECK-NEXT:    pushl %eax
42*926a71f0SMirko; CHECK-NEXT:    movl %esp, %eax
43*926a71f0SMirko; CHECK-NEXT:    movl %esp, -28(%ebp)
44*926a71f0SMirko; CHECK-NEXT:    movl $123, (%eax)
45*926a71f0SMirko; CHECK-NEXT:    movl $0, -16(%ebp)
46*926a71f0SMirko; CHECK-NEXT:    calll _alwaysthrows
47*926a71f0SMirko; CHECK-NEXT:  # %bb.4: # %unreachable.i
48*926a71f0SMirko; CHECK-NEXT:  LBB0_3: # Block address taken
49*926a71f0SMirko; CHECK-NEXT:    # %catch.i
50*926a71f0SMirko; CHECK-NEXT:    addl $12, %ebp
51*926a71f0SMirko; CHECK-NEXT:    jmp LBB0_5
52*926a71f0SMirko; CHECK-NEXT:    .def "?catch$2@?0?foo@4HA";
53*926a71f0SMirko; CHECK-NEXT:    .scl 3;
54*926a71f0SMirko; CHECK-NEXT:    .type 32;
55*926a71f0SMirko; CHECK-NEXT:    .endef
56*926a71f0SMirko; CHECK-NEXT:    .p2align 4
57*926a71f0SMirko; CHECK-NEXT:  "?catch$2@?0?foo@4HA":
58*926a71f0SMirko; CHECK-NEXT:  LBB0_2: # %catch.i
59*926a71f0SMirko; CHECK-NEXT:    pushl %ebp
60*926a71f0SMirko; CHECK-NEXT:    addl $12, %ebp
61*926a71f0SMirko; CHECK-NEXT:    movl %esp, -28(%ebp)
62*926a71f0SMirko; CHECK-NEXT:    movl $LBB0_3, %eax
63*926a71f0SMirko; CHECK-NEXT:    popl %ebp
64*926a71f0SMirko; CHECK-NEXT:    retl # CATCHRET
65*926a71f0SMirko; CHECK-NEXT:  Lfunc_end0:
66*926a71f0SMirkoentry:
67*926a71f0SMirko  %cmp = load i1, ptr @bar
68*926a71f0SMirko  br i1 %cmp, label %if.then, label %exit
69*926a71f0SMirko
70*926a71f0SMirkoif.then:                                          ; preds = %entry
71*926a71f0SMirko  %foo = alloca <{ %struct.Foo }>, align 4
72*926a71f0SMirko  store i32 123, ptr %foo, align 4
73*926a71f0SMirko  invoke void @alwaysthrows() #1
74*926a71f0SMirko          to label %unreachable.i unwind label %catch.dispatch.i
75*926a71f0SMirko
76*926a71f0SMirkocatch.dispatch.i:                                 ; preds = %if.then
77*926a71f0SMirko  %3 = catchswitch within none [label %catch.i] unwind to caller
78*926a71f0SMirko
79*926a71f0SMirkocatch.i:                                          ; preds = %catch.dispatch.i
80*926a71f0SMirko  %4 = catchpad within %3 [ptr null, i32 64, ptr null]
81*926a71f0SMirko  catchret from %4 to label %exit
82*926a71f0SMirko
83*926a71f0SMirkounreachable.i:                                    ; preds = %if.then
84*926a71f0SMirko  unreachable
85*926a71f0SMirko
86*926a71f0SMirkoexit:                                             ; preds = %entry, %catch.i
87*926a71f0SMirko  ret i32 0
88*926a71f0SMirko}
89*926a71f0SMirko
90*926a71f0SMirkodeclare dso_local i32 @__CxxFrameHandler3(...)
91*926a71f0SMirko
92*926a71f0SMirkodeclare dso_local void @alwaysthrows() local_unnamed_addr
93*926a71f0SMirko
94*926a71f0SMirkoattributes #0 = { norecurse "min-legal-vector-width"="0" "target-cpu"="pentium4" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
95*926a71f0SMirkoattributes #1 = { noreturn }
96