75 lines · plain
1; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s -enable-shrink-wrap=false | FileCheck %s2; Make sure shrink-wrapping does not break the lowering of exception handling.3; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s -enable-shrink-wrap=true -pass-remarks-output=%t | FileCheck %s4; RUN: cat %t | FileCheck %s --check-prefix=REMARKS5 6; Repro cases from PR251687 8; test @catchret - catchret target is not address-taken until PEI9; splits it into lea/mov followed by ret. Make sure the MBB is10; handled, both by tempting BranchFolding to merge it with %early_out11; and delete it, and by checking that we emit a proper reference12; to it in the LEA13 14declare void @ProcessCLRException()15declare void @f()16 17define void @catchret(i1 %b) personality ptr @ProcessCLRException {18entry:19 br i1 %b, label %body, label %early_out20early_out:21 ret void22body:23 invoke void @f()24 to label %exit unwind label %catch.pad25catch.pad:26 %cs1 = catchswitch within none [label %catch.body] unwind to caller27catch.body:28 %catch = catchpad within %cs1 [i32 33554467]29 catchret from %catch to label %exit30exit:31 ret void32}33; CHECK-LABEL: catchret: # @catchret34; CHECK: [[Exit:^[^ :]+]]: # Block address taken35; CHECK-NEXT: # %exit36; CHECK: # %catch.body37; CHECK: .seh_endprolog38; CHECK: leaq [[Exit]](%rip), %rax39; CHECK: retq # CATCHRET40 41; REMARKS: Pass: shrink-wrap42; REMARKS-NEXT: Name: UnsupportedEHFunclets43; REMARKS-NEXT: Function: catchret44; REMARKS-NEXT: Args:45; REMARKS-NEXT: - String: EH Funclets are not supported yet.46 47; test @setjmp - similar to @catchret, but the MBB in question48; is the one generated when the setjmp's block is split49 50@buf = internal global [5 x ptr] zeroinitializer51declare ptr @llvm.frameaddress(i32) nounwind readnone52declare ptr @llvm.stacksave() nounwind53declare i32 @llvm.eh.sjlj.setjmp(ptr) nounwind54declare void @llvm.eh.sjlj.longjmp(ptr) nounwind55 56define void @setjmp(i1 %b) nounwind {57entry:58 br i1 %b, label %early_out, label %sj59early_out:60 ret void61sj:62 %fp = call ptr @llvm.frameaddress(i32 0)63 store ptr %fp, ptr @buf, align 1664 %sp = call ptr @llvm.stacksave()65 store ptr %sp, ptr getelementptr inbounds ([5 x ptr], ptr @buf, i64 0, i64 2), align 1666 call i32 @llvm.eh.sjlj.setjmp(ptr @buf)67 ret void68}69; CHECK-LABEL: setjmp: # @setjmp70; CHECK: # %sj71; CHECK: leaq [[Label:\..+]](%rip), %[[Reg:.+]]{{$}}72; CHECK-NEXT: movq %[[Reg]], buf73; CHECK: {{^}}[[Label]]: # Block address taken74; CHECK-NEXT: # %sj75