77 lines · plain
1; RUN: llc < %s | FileCheck %s2 3target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"4target triple = "x86_64-pc-windows-msvc"5 6declare i32 @__CxxFrameHandler3(...)7declare void @throw() uwtable8declare ptr @getval()9declare void @llvm.trap()10 11define ptr @reload_out_of_pad(ptr %arg) #0 personality ptr @__CxxFrameHandler3 {12assertPassed:13 invoke void @throw()14 to label %unreachable unwind label %catch.dispatch15 16catch:17 %cp = catchpad within %cs [ptr null, i32 0, ptr null]18 catchret from %cp to label %return19 20 ; This block *must* appear after the catchret to test the bug.21 ; FIXME: Make this an MIR test so we can control MBB layout.22unreachable:23 call void @llvm.trap()24 unreachable25 26catch.dispatch:27 %cs = catchswitch within none [label %catch] unwind to caller28 29return:30 ret ptr %arg31}32 33; CHECK-LABEL: reload_out_of_pad: # @reload_out_of_pad34; CHECK: movq %rcx, -[[arg_slot:[0-9]+]](%rbp) # 8-byte Spill35; CHECK: callq throw36; CHECK: ud237; CHECK: movq -[[arg_slot]](%rbp), %rax # 8-byte Reload38; CHECK: retq39 40; CHECK: "?catch${{[0-9]+}}@?0?reload_out_of_pad@4HA":41; CHECK-NOT: Reload42; CHECK: retq43 44define ptr @spill_in_pad() #0 personality ptr @__CxxFrameHandler3 {45assertPassed:46 invoke void @throw()47 to label %unreachable unwind label %catch.dispatch48 49catch:50 %cp = catchpad within %cs [ptr null, i32 0, ptr null]51 %val = call ptr @getval() [ "funclet"(token %cp) ]52 catchret from %cp to label %return53 54unreachable:55 call void @llvm.trap()56 unreachable57 58catch.dispatch:59 %cs = catchswitch within none [label %catch] unwind to caller60 61return:62 ret ptr %val63}64 65; CHECK-LABEL: spill_in_pad: # @spill_in_pad66; CHECK: callq throw67; CHECK: ud268; CHECK: movq -[[val_slot:[0-9]+]](%rbp), %rax # 8-byte Reload69; CHECK: retq70 71; CHECK: "?catch${{[0-9]+}}@?0?spill_in_pad@4HA":72; CHECK: callq getval73; CHECK: movq %rax, -[[val_slot]](%rbp) # 8-byte Spill74; CHECK: retq75 76attributes #0 = { uwtable }77