1 ; RUN: llc -o - %s -mtriple=aarch64-windows | FileCheck %s
2 ; Check that we allocate the unwind help stack object in a fixed location from fp
3 ; so that the runtime can find it when handling an exception
4 target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
5 target triple = "aarch64-pc-windows-msvc19.25.28611"
7 ; Check that the store to the unwind help object for func2 is via FP
8 ; CHECK-LABEL: ?func2@@YAXXZ
9 ; CHECK: mov x[[#SCRATCH_REG:]], #-2
10 ; CHECK: stur x[[#SCRATCH_REG:]], [x29, #[[#]]]
12 ; // struct that requires greater than stack alignment
13 ; struct alignas(32) A
15 ; // data that would be invalid for unwind help (> 0)
16 ; int _x[4]{42, 42, 42, 42};
20 ; // cause us to run the funclet in func2
26 ; // the funclet that ensures we have the unwind help correct
33 ; // function to ensure we are misaligned in func2
39 ; // set things up and ensure alignment for func1
48 %struct.A = type { [4 x i32], [16 x i8] }
49 declare dso_local ptr @"??0A@@QEAA@XZ"(ptr returned %0)
50 declare dso_local void @"??1A@@QEAA@XZ"(ptr %0)
51 declare dso_local i32 @__CxxFrameHandler3(...)
52 declare dso_local void @"?func3@@YAXXZ"()
54 ; Function Attrs: noinline optnone uwtable
55 define dso_local void @"?func2@@YAXXZ"() #0 personality ptr @__CxxFrameHandler3 {
56 %1 = alloca %struct.A, align 32
57 %2 = call ptr @"??0A@@QEAA@XZ"(ptr %1) #3
58 invoke void @"?func3@@YAXXZ"()
59 to label %3 unwind label %4
62 call void @"??1A@@QEAA@XZ"(ptr %1) #3
66 %5 = cleanuppad within none []
67 call void @"??1A@@QEAA@XZ"(ptr %1) #3 [ "funclet"(token %5) ]
68 cleanupret from %5 unwind to caller