1 ; RUN: llc < %s | FileCheck %s
3 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-pc-windows-msvc"
6 declare i32 @__CxxFrameHandler3(...)
7 declare void @throw() noreturn uwtable
10 define i8* @reload_out_of_pad(i8* %arg) #0 personality i32 (...)* @__CxxFrameHandler3 {
13 to label %unreachable unwind label %catch.dispatch
16 %cp = catchpad within %cs [i8* null, i32 0, i8* null]
17 catchret from %cp to label %return
19 ; This block *must* appear after the catchret to test the bug.
20 ; FIXME: Make this an MIR test so we can control MBB layout.
25 %cs = catchswitch within none [label %catch] unwind to caller
31 ; CHECK-LABEL: reload_out_of_pad: # @reload_out_of_pad
32 ; CHECK: movq %rcx, -[[arg_slot:[0-9]+]](%rbp) # 8-byte Spill
35 ; CHECK: movq -[[arg_slot]](%rbp), %rax # 8-byte Reload
38 ; CHECK: "?catch$3@?0?reload_out_of_pad@4HA":
42 define i8* @spill_in_pad() #0 personality i32 (...)* @__CxxFrameHandler3 {
45 to label %unreachable unwind label %catch.dispatch
48 %cp = catchpad within %cs [i8* null, i32 0, i8* null]
49 %val = call i8* @getval() [ "funclet"(token %cp) ]
50 catchret from %cp to label %return
56 %cs = catchswitch within none [label %catch] unwind to caller
62 ; CHECK-LABEL: spill_in_pad: # @spill_in_pad
65 ; CHECK: movq -[[val_slot:[0-9]+]](%rbp), %rax # 8-byte Reload
68 ; CHECK: "?catch$3@?0?spill_in_pad@4HA":
70 ; CHECK: movq %rax, -[[val_slot]](%rbp) # 8-byte Spill
73 attributes #0 = { uwtable }