xref: /llvm-project/llvm/test/CodeGen/AArch64/wineh-try-catch-cbz.ll (revision 5ddce70ef0e5a641d7fea95e31fc5e2439cb98cb)
1; RUN: llc < %s | FileCheck %s
2
3; Make sure the prologue is sane.  (Doesn't need to exactly match this,
4; but the original issue only reproduced if the cbz was immediately
5; after the frame setup.)
6
7; CHECK: stp     x29, x30, [sp, #-32]!
8; CHECK-NEXT: .seh_save_fplr_x 32
9; CHECK-NEXT: mov     x29, sp
10; CHECK-NEXT: .seh_set_fp
11; CHECK-NEXT: .seh_endprologue
12; CHECK-NEXT: mov     x1, #-2
13; CHECK-NEXT: stur    x1, [x29, #16]
14; CHECK-NEXT: cbz     w0, .LBB0_2
15
16target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
17target triple = "aarch64-unknown-windows-msvc19.11.0"
18
19; Function Attrs: uwtable
20define dso_local void @"?f@@YAXH@Z"(i32 %x) local_unnamed_addr #0 personality ptr @__CxxFrameHandler3 {
21entry:
22  %cmp = icmp eq i32 %x, 0
23  br i1 %cmp, label %try.cont, label %if.then
24
25if.then:                                          ; preds = %entry
26  invoke void @"?g@@YAXXZ"()
27          to label %try.cont unwind label %catch.dispatch
28
29catch.dispatch:                                   ; preds = %if.then
30  %0 = catchswitch within none [label %catch] unwind to caller
31
32catch:                                            ; preds = %catch.dispatch
33  %1 = catchpad within %0 [ptr null, i32 64, ptr null]
34  catchret from %1 to label %try.cont
35
36try.cont:                                         ; preds = %entry, %if.then, %catch
37  ret void
38}
39
40declare dso_local void @"?g@@YAXXZ"() local_unnamed_addr #1
41
42declare dso_local i32 @__CxxFrameHandler3(...)
43