xref: /llvm-project/llvm/test/CodeGen/WinEH/wineh-scope-statenumbering.ll (revision 21af99ab84e434819b20452367325b187492d372)
1*21af99abSMaurice Heumann; RUN: opt -mtriple=i386-pc-windows-msvc -S -x86-winehstate < %s | FileCheck %s
2*21af99abSMaurice Heumann
3*21af99abSMaurice Heumanntarget 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*21af99abSMaurice Heumanntarget triple = "i386-pc-windows-msvc19.42.34433"
5*21af99abSMaurice Heumann
6*21af99abSMaurice Heumann%struct.Destructor = type { ptr }
7*21af99abSMaurice Heumann
8*21af99abSMaurice Heumanndefine dso_local void @"?HandleDestructorCallWithException@@YAXPA_N@Z"(ptr noundef %destructorCalled) personality ptr @__CxxFrameHandler3 {
9*21af99abSMaurice Heumannentry:
10*21af99abSMaurice Heumann  %destructorCalled.addr = alloca ptr, align 4
11*21af99abSMaurice Heumann  %x = alloca %struct.Destructor, align 4
12*21af99abSMaurice Heumann  store ptr %destructorCalled, ptr %destructorCalled.addr, align 4
13*21af99abSMaurice Heumann  %0 = load ptr, ptr %destructorCalled.addr, align 4
14*21af99abSMaurice Heumann  %call = call x86_thiscallcc noundef ptr @"??0Destructor@@QAE@PA_N@Z"(ptr noundef nonnull align 4 dereferenceable(4) %x, ptr noundef %0)
15*21af99abSMaurice Heumann  ; CHECK:  store i32 0, ptr %9, align 4
16*21af99abSMaurice Heumann  ; CHECK-NEXT:  invoke void @llvm.seh.scope.begin()
17*21af99abSMaurice Heumann  invoke void @llvm.seh.scope.begin()
18*21af99abSMaurice Heumann          to label %invoke.cont unwind label %ehcleanup
19*21af99abSMaurice Heumann
20*21af99abSMaurice Heumanninvoke.cont:
21*21af99abSMaurice Heumann  store i32 1, ptr inttoptr (i32 1 to ptr), align 4
22*21af99abSMaurice Heumann  ; CHECK:  store i32 -1, ptr %10, align 4
23*21af99abSMaurice Heumann  ; CHECK-NEXT:  invoke void @llvm.seh.scope.end()
24*21af99abSMaurice Heumann  invoke void @llvm.seh.scope.end()
25*21af99abSMaurice Heumann          to label %invoke.cont1 unwind label %ehcleanup
26*21af99abSMaurice Heumann
27*21af99abSMaurice Heumanninvoke.cont1:
28*21af99abSMaurice Heumann  call x86_thiscallcc void @"??1Destructor@@QAE@XZ"(ptr noundef nonnull align 4 dereferenceable(4) %x) #1
29*21af99abSMaurice Heumann  ret void
30*21af99abSMaurice Heumann
31*21af99abSMaurice Heumannehcleanup:
32*21af99abSMaurice Heumann  %1 = cleanuppad within none []
33*21af99abSMaurice Heumann  call x86_thiscallcc void @"??1Destructor@@QAE@XZ"(ptr noundef nonnull align 4 dereferenceable(4) %x) #1 [ "funclet"(token %1) ]
34*21af99abSMaurice Heumann  cleanupret from %1 unwind to caller
35*21af99abSMaurice Heumann}
36*21af99abSMaurice Heumann
37*21af99abSMaurice Heumanndeclare dso_local i32 @__CxxFrameHandler3(...)
38*21af99abSMaurice Heumanndeclare dso_local void @llvm.seh.scope.begin() #0
39*21af99abSMaurice Heumanndeclare dso_local void @llvm.seh.scope.end() #0
40*21af99abSMaurice Heumann
41*21af99abSMaurice Heumanndeclare dso_local x86_thiscallcc noundef ptr @"??0Destructor@@QAE@PA_N@Z"(ptr noundef nonnull returned align 4 dereferenceable(4) %this, ptr noundef %destructorCalled)
42*21af99abSMaurice Heumanndeclare dso_local x86_thiscallcc void @"??1Destructor@@QAE@XZ"(ptr noundef nonnull align 4 dereferenceable(4) %this) #1
43*21af99abSMaurice Heumann
44*21af99abSMaurice Heumannattributes #0 = { nounwind memory(none) }
45*21af99abSMaurice Heumannattributes #1 = { nounwind }
46