1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/CodeGen/AArch64/wineh-unwindhelp-via-fp.ll
Daniel Frampton 6ef34b9601 [AArch64] Change AArch64 Windows EH UnwindHelp object to be a fixed object
The UnwindHelp object is used during exception handling by runtime
code. It must be findable from a fixed offset from FP.

This change allocates the UnwindHelp object as a fixed object (as is
done for x86_64) to ensure that both the generated code and runtime
agree on the location of the object.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45346

Differential Revision: https://reviews.llvm.org/D77016
2020-03-31 14:21:21 -07:00

70 lines
2.0 KiB
LLVM

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