|
| 1 | +; RUN: opt -mtriple=i386-pc-windows-msvc -S -x86-winehstate < %s | FileCheck %s |
| 2 | + |
| 3 | +target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32-a:0:32-S32" |
| 4 | +target triple = "i386-pc-windows-msvc19.42.34433" |
| 5 | + |
| 6 | +%struct.Destructor = type { ptr } |
| 7 | + |
| 8 | +define dso_local void @"?HandleDestructorCallWithException@@YAXPA_N@Z"(ptr noundef %destructorCalled) personality ptr @__CxxFrameHandler3 { |
| 9 | +entry: |
| 10 | + %destructorCalled.addr = alloca ptr, align 4 |
| 11 | + %x = alloca %struct.Destructor, align 4 |
| 12 | + store ptr %destructorCalled, ptr %destructorCalled.addr, align 4 |
| 13 | + %0 = load ptr, ptr %destructorCalled.addr, align 4 |
| 14 | + %call = call x86_thiscallcc noundef ptr @"??0Destructor@@QAE@PA_N@Z"(ptr noundef nonnull align 4 dereferenceable(4) %x, ptr noundef %0) |
| 15 | + ; CHECK: store i32 0, ptr %9, align 4 |
| 16 | + ; CHECK-NEXT: invoke void @llvm.seh.scope.begin() |
| 17 | + invoke void @llvm.seh.scope.begin() |
| 18 | + to label %invoke.cont unwind label %ehcleanup |
| 19 | + |
| 20 | +invoke.cont: |
| 21 | + store i32 1, ptr inttoptr (i32 1 to ptr), align 4 |
| 22 | + invoke void @llvm.seh.scope.end() |
| 23 | + to label %invoke.cont1 unwind label %ehcleanup |
| 24 | + |
| 25 | +invoke.cont1: |
| 26 | + ; CHECK: invoke.cont1: |
| 27 | + ; CHECK-NEXT:%10 = getelementptr inbounds nuw %CXXExceptionRegistration, ptr %0, i32 0, i32 2 |
| 28 | + ; CHECK-NEXT: store i32 -1, ptr %10, align 4 |
| 29 | + call x86_thiscallcc void @"??1Destructor@@QAE@XZ"(ptr noundef nonnull align 4 dereferenceable(4) %x) #1 |
| 30 | + ret void |
| 31 | + |
| 32 | +ehcleanup: |
| 33 | + %1 = cleanuppad within none [] |
| 34 | + call x86_thiscallcc void @"??1Destructor@@QAE@XZ"(ptr noundef nonnull align 4 dereferenceable(4) %x) #1 [ "funclet"(token %1) ] |
| 35 | + cleanupret from %1 unwind to caller |
| 36 | +} |
| 37 | + |
| 38 | +declare dso_local i32 @__CxxFrameHandler3(...) |
| 39 | +declare dso_local void @llvm.seh.scope.begin() #0 |
| 40 | +declare dso_local void @llvm.seh.scope.end() #0 |
| 41 | + |
| 42 | +declare dso_local x86_thiscallcc noundef ptr @"??0Destructor@@QAE@PA_N@Z"(ptr noundef nonnull returned align 4 dereferenceable(4) %this, ptr noundef %destructorCalled) |
| 43 | +declare dso_local x86_thiscallcc void @"??1Destructor@@QAE@XZ"(ptr noundef nonnull align 4 dereferenceable(4) %this) #1 |
| 44 | + |
| 45 | +attributes #0 = { nounwind memory(none) } |
| 46 | +attributes #1 = { nounwind } |
0 commit comments