200 lines · plain
1; RUN: llc -verify-machineinstrs -mtriple=i686-pc-windows-msvc < %s | FileCheck --check-prefix=X86 %s2; RUN: llc -verify-machineinstrs -mtriple=x86_64-pc-windows-msvc < %s | FileCheck --check-prefix=X64 %s3 4%struct.Dtor = type { i8 }5 6define void @simple_cleanup() #0 personality ptr @__CxxFrameHandler3 {7entry:8 %o = alloca %struct.Dtor, align 19 invoke void @f(i32 1)10 to label %invoke.cont unwind label %ehcleanup11 12invoke.cont: ; preds = %entry13 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(ptr %o) #214 ret void15 16ehcleanup: ; preds = %entry17 %0 = cleanuppad within none []18 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(ptr %o) #2 [ "funclet"(token %0) ]19 cleanupret from %0 unwind to caller20}21 22; CHECK: simple_cleanup: # @simple_cleanup23; CHECK: pushq %rbp24; CHECK: subq $48, %rsp25; CHECK: leaq 48(%rsp), %rbp26; CHECK: movq $-2, -8(%rbp)27; CHECK: movl $1, %ecx28; CHECK: callq f29; CHECK: callq "??1Dtor@@QAE@XZ"30; CHECK: nop31; CHECK: addq $48, %rsp32; CHECK: popq %rbp33; CHECK: retq34 35; CHECK: "?dtor$2@?0?simple_cleanup@4HA":36; CHECK: callq "??1Dtor@@QAE@XZ"37; CHECK: retq38 39; CHECK: $cppxdata$simple_cleanup:40; CHECK-NEXT: .long 42906550641; CHECK-NEXT: .long 142; CHECK-NEXT: .long $stateUnwindMap$simple_cleanup@IMGREL43; CHECK-NEXT: .long 044; CHECK-NEXT: .long 045; CHECK-NEXT: .long 346; CHECK-NEXT: .long $ip2state$simple_cleanup@IMGREL47; UnwindHelp offset should match the -2 store above48; CHECK-NEXT: .long 4049; CHECK-NEXT: .long 050; CHECK-NEXT: .long 151 52declare void @f(i32) #053 54declare i32 @__CxxFrameHandler3(...)55 56; Function Attrs: nounwind57declare x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(ptr) #158 59define void @nested_cleanup() #0 personality ptr @__CxxFrameHandler3 {60entry:61 %o1 = alloca %struct.Dtor, align 862 %o2 = alloca %struct.Dtor, align 863 invoke void @f(i32 1)64 to label %invoke.cont unwind label %cleanup.outer65 66invoke.cont: ; preds = %entry67 invoke void @f(i32 2)68 to label %invoke.cont.1 unwind label %cleanup.inner69 70invoke.cont.1: ; preds = %invoke.cont71 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(ptr %o2) #272 invoke void @f(i32 3)73 to label %invoke.cont.2 unwind label %cleanup.outer74 75invoke.cont.2: ; preds = %invoke.cont.176 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(ptr %o1) #277 ret void78 79cleanup.inner: ; preds = %invoke.cont80 %0 = cleanuppad within none []81 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(ptr %o2) #2 [ "funclet"(token %0) ]82 cleanupret from %0 unwind label %cleanup.outer83 84cleanup.outer: ; preds = %invoke.cont.1, %cleanup.inner, %entry85 %1 = cleanuppad within none []86 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(ptr %o1) #2 [ "funclet"(token %1) ]87 cleanupret from %1 unwind to caller88}89 90; X86-LABEL: _nested_cleanup:91; X86: pushl $192; X86: calll _f93; X86: pushl $294; X86: calll _f95; X86: pushl $396; X86: calll _f97 98; X86: "?dtor$[[cleanup_inner:[0-9]+]]@?0?nested_cleanup@4HA":99; X86: LBB1_[[cleanup_inner]]: # %cleanup.inner{{$}}100; X86: pushl %ebp101; X86: leal {{.*}}(%ebp), %ecx102; X86: calll "??1Dtor@@QAE@XZ"103; X86: popl %ebp104; X86: retl105 106; X86: "?dtor$[[cleanup_outer:[0-9]+]]@?0?nested_cleanup@4HA":107; X86: LBB1_[[cleanup_outer]]: # %cleanup.outer{{$}}108; X86: pushl %ebp109; X86: leal {{.*}}(%ebp), %ecx110; X86: calll "??1Dtor@@QAE@XZ"111; X86: popl %ebp112; X86: retl113 114; X86: L__ehtable$nested_cleanup:115; X86: .long 429065506116; X86: .long 2117; X86: .long $stateUnwindMap$nested_cleanup118; X86: .long 0119; X86: .long 0120; X86: .long 0121; X86: .long 0122; X86: .long 0123; X86: .long 1124; X86: $stateUnwindMap$nested_cleanup:125; X86: .long -1126; X86: .long "?dtor$[[cleanup_outer]]@?0?nested_cleanup@4HA"127; X86: .long 0128; X86: .long "?dtor$[[cleanup_inner]]@?0?nested_cleanup@4HA"129 130; X64-LABEL: nested_cleanup:131; X64: .Lfunc_begin1:132; X64: .Ltmp2:133; X64: movl $1, %ecx134; X64: callq f135; X64: .Ltmp4:136; X64: movl $2, %ecx137; X64: callq f138; X64: .Ltmp5:139; X64: callq "??1Dtor@@QAE@XZ"140; X64: .Ltmp6:141; X64: movl $3, %ecx142; X64: callq f143; X64: .Ltmp7:144 145; X64: "?dtor$[[cleanup_inner:[0-9]+]]@?0?nested_cleanup@4HA":146; X64: LBB1_[[cleanup_inner]]: # %cleanup.inner{{$}}147; X64: pushq %rbp148; X64: leaq {{.*}}(%rbp), %rcx149; X64: callq "??1Dtor@@QAE@XZ"150; X64: popq %rbp151; X64: retq152 153; X64: .seh_handlerdata154; X64: .text155; X64: .seh_endproc156 157; X64: "?dtor$[[cleanup_outer:[0-9]+]]@?0?nested_cleanup@4HA":158; X64: LBB1_[[cleanup_outer]]: # %cleanup.outer{{$}}159; X64: pushq %rbp160; X64: leaq {{.*}}(%rbp), %rcx161; X64: callq "??1Dtor@@QAE@XZ"162; X64: popq %rbp163; X64: retq164 165; X64: .section .xdata,"dr"166; X64-NEXT: .p2align 2167; X64: $cppxdata$nested_cleanup:168; X64-NEXT: .long 429065506169; X64-NEXT: .long 2170; X64-NEXT: .long $stateUnwindMap$nested_cleanup@IMGREL171; X64-NEXT: .long 0172; X64-NEXT: .long 0173; X64-NEXT: .long 5174; X64-NEXT: .long $ip2state$nested_cleanup@IMGREL175; X64-NEXT: .long 56176; X64-NEXT: .long 0177; X64-NEXT: .long 1178 179; X64: $stateUnwindMap$nested_cleanup:180; X64-NEXT: .long -1181; X64-NEXT: .long "?dtor$[[cleanup_outer]]@?0?nested_cleanup@4HA"@IMGREL182; X64-NEXT: .long 0183; X64-NEXT: .long "?dtor$[[cleanup_inner]]@?0?nested_cleanup@4HA"@IMGREL184 185; X64: $ip2state$nested_cleanup:186; X64-NEXT: .long .Lfunc_begin1@IMGREL187; X64-NEXT: .long -1188; X64-NEXT: .long .Ltmp2@IMGREL189; X64-NEXT: .long 0190; X64-NEXT: .long .Ltmp4@IMGREL191; X64-NEXT: .long 1192; X64-NEXT: .long .Ltmp6@IMGREL193; X64-NEXT: .long 0194; X64-NEXT: .long .Ltmp7@IMGREL195; X64-NEXT: .long -1196 197attributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "use-soft-float"="false" }198attributes #1 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "use-soft-float"="false" }199attributes #2 = { nounwind }200