1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3 2; RUN: llc -mtriple=i686-windows-msvc < %s | FileCheck %s --check-prefix=I686 3; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=X86_64 4 5@type_info = external global ptr 6 7; Make sure %a1 and %a2 don't share the same stack offset. 8define void @pr66984(ptr %arg) personality ptr @__CxxFrameHandler3 { 9; I686-LABEL: pr66984: 10; I686: # %bb.0: # %bb 11; I686-NEXT: pushl %ebp 12; I686-NEXT: movl %esp, %ebp 13; I686-NEXT: pushl %ebx 14; I686-NEXT: pushl %edi 15; I686-NEXT: pushl %esi 16; I686-NEXT: subl $24, %esp 17; I686-NEXT: movl %esp, -28(%ebp) 18; I686-NEXT: movl $-1, -16(%ebp) 19; I686-NEXT: leal -24(%ebp), %eax 20; I686-NEXT: movl $___ehhandler$pr66984, -20(%ebp) 21; I686-NEXT: movl %fs:0, %ecx 22; I686-NEXT: movl %ecx, -24(%ebp) 23; I686-NEXT: movl %eax, %fs:0 24; I686-NEXT: movl $1, -16(%ebp) 25; I686-NEXT: calll _throw 26; I686-NEXT: # %bb.1: # %bb14 27; I686-NEXT: LBB0_3: # Block address taken 28; I686-NEXT: # %bb17 29; I686-NEXT: addl $12, %ebp 30; I686-NEXT: jmp LBB0_4 31; I686-NEXT: LBB0_4: # %exit 32; I686-NEXT: $ehgcr_0_4: 33; I686-NEXT: movl -24(%ebp), %eax 34; I686-NEXT: movl %eax, %fs:0 35; I686-NEXT: addl $24, %esp 36; I686-NEXT: popl %esi 37; I686-NEXT: popl %edi 38; I686-NEXT: popl %ebx 39; I686-NEXT: popl %ebp 40; I686-NEXT: retl 41; I686-NEXT: .def "?catch$2@?0?pr66984@4HA"; 42; I686-NEXT: .scl 3; 43; I686-NEXT: .type 32; 44; I686-NEXT: .endef 45; I686-NEXT: .p2align 4 46; I686-NEXT: "?catch$2@?0?pr66984@4HA": 47; I686-NEXT: LBB0_2: # %bb17 48; I686-NEXT: pushl %ebp 49; I686-NEXT: addl $12, %ebp 50; I686-NEXT: movl %esp, -28(%ebp) 51; I686-NEXT: movl -36(%ebp), %ecx 52; I686-NEXT: movl $2, -16(%ebp) 53; I686-NEXT: calll _cleanup 54; I686-NEXT: movl $LBB0_3, %eax 55; I686-NEXT: popl %ebp 56; I686-NEXT: retl # CATCHRET 57; I686-NEXT: .def "?dtor$5@?0?pr66984@4HA"; 58; I686-NEXT: .scl 3; 59; I686-NEXT: .type 32; 60; I686-NEXT: .endef 61; I686-NEXT: .p2align 4 62; I686-NEXT: "?dtor$5@?0?pr66984@4HA": 63; I686-NEXT: LBB0_5: # %bb8 64; I686-NEXT: pushl %ebp 65; I686-NEXT: addl $12, %ebp 66; I686-NEXT: movl 8(%ebp), %eax 67; I686-NEXT: movl %eax, -32(%ebp) 68; I686-NEXT: leal -32(%ebp), %ecx 69; I686-NEXT: calll _foo 70; I686-NEXT: popl %ebp 71; I686-NEXT: retl # CLEANUPRET 72; I686-NEXT: Lfunc_end0: 73; 74; X86_64-LABEL: pr66984: 75; X86_64: # %bb.0: # %bb 76; X86_64-NEXT: pushq %rbp 77; X86_64-NEXT: .seh_pushreg %rbp 78; X86_64-NEXT: subq $64, %rsp 79; X86_64-NEXT: .seh_stackalloc 64 80; X86_64-NEXT: leaq {{[0-9]+}}(%rsp), %rbp 81; X86_64-NEXT: .seh_setframe %rbp, 64 82; X86_64-NEXT: .seh_endprologue 83; X86_64-NEXT: movq $-2, -16(%rbp) 84; X86_64-NEXT: movq %rcx, {{[-0-9]+}}(%r{{[sb]}}p) # 8-byte Spill 85; X86_64-NEXT: .Ltmp0: 86; X86_64-NEXT: callq throw 87; X86_64-NEXT: .Ltmp1: 88; X86_64-NEXT: # %bb.1: # %bb14 89; X86_64-NEXT: .LBB0_3: # Block address taken 90; X86_64-NEXT: # %exit 91; X86_64-NEXT: $ehgcr_0_3: 92; X86_64-NEXT: nop 93; X86_64-NEXT: addq $64, %rsp 94; X86_64-NEXT: popq %rbp 95; X86_64-NEXT: retq 96; X86_64-NEXT: .seh_handlerdata 97; X86_64-NEXT: .long ($cppxdata$pr66984)@IMGREL 98; X86_64-NEXT: .text 99; X86_64-NEXT: .seh_endproc 100; X86_64-NEXT: .def "?catch$2@?0?pr66984@4HA"; 101; X86_64-NEXT: .scl 3; 102; X86_64-NEXT: .type 32; 103; X86_64-NEXT: .endef 104; X86_64-NEXT: .p2align 4 105; X86_64-NEXT: "?catch$2@?0?pr66984@4HA": 106; X86_64-NEXT: .seh_proc "?catch$2@?0?pr66984@4HA" 107; X86_64-NEXT: .seh_handler __CxxFrameHandler3, @unwind, @except 108; X86_64-NEXT: .LBB0_2: # %bb17 109; X86_64-NEXT: movq %rdx, {{[0-9]+}}(%rsp) 110; X86_64-NEXT: pushq %rbp 111; X86_64-NEXT: .seh_pushreg %rbp 112; X86_64-NEXT: subq $32, %rsp 113; X86_64-NEXT: .seh_stackalloc 32 114; X86_64-NEXT: leaq 64(%rdx), %rbp 115; X86_64-NEXT: .seh_endprologue 116; X86_64-NEXT: movq -8(%rbp), %rcx 117; X86_64-NEXT: callq cleanup 118; X86_64-NEXT: leaq .LBB0_3(%rip), %rax 119; X86_64-NEXT: addq $32, %rsp 120; X86_64-NEXT: popq %rbp 121; X86_64-NEXT: retq # CATCHRET 122; X86_64-NEXT: .seh_handlerdata 123; X86_64-NEXT: .long ($cppxdata$pr66984)@IMGREL 124; X86_64-NEXT: .text 125; X86_64-NEXT: .seh_endproc 126; X86_64-NEXT: .def "?dtor$4@?0?pr66984@4HA"; 127; X86_64-NEXT: .scl 3; 128; X86_64-NEXT: .type 32; 129; X86_64-NEXT: .endef 130; X86_64-NEXT: .p2align 4 131; X86_64-NEXT: "?dtor$4@?0?pr66984@4HA": 132; X86_64-NEXT: .seh_proc "?dtor$4@?0?pr66984@4HA" 133; X86_64-NEXT: .LBB0_4: # %bb8 134; X86_64-NEXT: movq %rdx, {{[0-9]+}}(%rsp) 135; X86_64-NEXT: pushq %rbp 136; X86_64-NEXT: .seh_pushreg %rbp 137; X86_64-NEXT: subq $32, %rsp 138; X86_64-NEXT: .seh_stackalloc 32 139; X86_64-NEXT: leaq 64(%rdx), %rbp 140; X86_64-NEXT: .seh_endprologue 141; X86_64-NEXT: movq {{[-0-9]+}}(%r{{[sb]}}p), %rax # 8-byte Reload 142; X86_64-NEXT: movq %rax, -32(%rbp) 143; X86_64-NEXT: leaq -32(%rbp), %rcx 144; X86_64-NEXT: callq foo 145; X86_64-NEXT: nop 146; X86_64-NEXT: addq $32, %rsp 147; X86_64-NEXT: popq %rbp 148; X86_64-NEXT: retq # CLEANUPRET 149; X86_64-NEXT: .Lfunc_end0: 150; X86_64-NEXT: .seh_handlerdata 151; X86_64-NEXT: .text 152; X86_64-NEXT: .seh_endproc 153bb: 154 %a1 = alloca ptr, align 4 155 %a2 = alloca ptr, align 4 156 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a2) 157 invoke void @throw() 158 to label %bb14 unwind label %bb8 159 160bb8: ; preds = %bb7 161 %i9 = cleanuppad within none [] 162 call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %a1) 163 store ptr %arg, ptr %a1, align 4 164 call fastcc void @foo(ptr %a1) [ "funclet"(token %i9) ] 165 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a1) 166 cleanupret from %i9 unwind label %bb15 167 168bb14: ; preds = %bb7 169 unreachable 170 171bb15: ; preds = %bb13, %bb5 172 %cs = catchswitch within none [label %bb17] unwind to caller 173 174bb17: ; preds = %bb15 175 %cp = catchpad within %cs [ptr @type_info, i32 8, ptr %a2] 176 %p = load ptr, ptr %a2, align 4 177 call fastcc void @cleanup(ptr %p) [ "funclet"(token %cp) ] 178 catchret from %cp to label %exit 179 180exit: 181 call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %a2) 182 ret void 183} 184 185declare i32 @__CxxFrameHandler3(...) 186declare void @throw() 187declare void @cleanup(ptr) 188declare void @foo(ptr) 189declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) 190declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) 191