1 ; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s
3 ; Repro cases from PR25168
5 ; test @catchret - catchret target is not address-taken until PEI
6 ; splits it into lea/mov followed by ret. Make sure the MBB is
7 ; handled, both by tempting BranchFolding to merge it with %early_out
8 ; and delete it, and by checking that we emit a proper reference
11 declare void @ProcessCLRException()
14 define void @catchret(i1 %b) personality void ()* @ProcessCLRException {
16 br i1 %b, label %body, label %early_out
21 to label %exit unwind label %catch.pad
23 %catch = catchpad [i32 33554467]
24 to label %catch.body unwind label %catch.end
26 catchret %catch to label %exit
28 catchendpad unwind to caller
32 ; CHECK-LABEL: catchret: # @catchret
33 ; CHECK: [[Exit:^[^ :]+]]: # Block address taken
36 ; CHECK: .seh_endprolog
37 ; CHECK: leaq [[Exit]](%rip), %rax
38 ; CHECK: retq # CATCHRET
41 ; test @setjmp - similar to @catchret, but the MBB in question
42 ; is the one generated when the setjmp's block is split
44 @buf = internal global [5 x i8*] zeroinitializer
45 declare i8* @llvm.frameaddress(i32) nounwind readnone
46 declare i8* @llvm.stacksave() nounwind
47 declare i32 @llvm.eh.sjlj.setjmp(i8*) nounwind
48 declare void @llvm.eh.sjlj.longjmp(i8*) nounwind
50 define void @setjmp(i1 %b) nounwind {
52 br i1 %b, label %early_out, label %sj
56 %fp = call i8* @llvm.frameaddress(i32 0)
57 store i8* %fp, i8** getelementptr inbounds ([5 x i8*], [5 x i8*]* @buf, i64 0, i64 0), align 16
58 %sp = call i8* @llvm.stacksave()
59 store i8* %sp, i8** getelementptr inbounds ([5 x i8*], [5 x i8*]* @buf, i64 0, i64 2), align 16
60 call i32 @llvm.eh.sjlj.setjmp(i8* bitcast ([5 x i8*]* @buf to i8*))
63 ; CHECK-LABEL: setjmp: # @setjmp
65 ; CHECK: leaq [[Label:\..+]](%rip), %[[Reg:.+]]{{$}}
66 ; CHECK-NEXT: movq %[[Reg]], buf
67 ; CHECK: {{^}}[[Label]]: # Block address taken