llvm.org GIT mirror llvm / d774692
[WinEH] Visit 'unwind to caller' catchswitches nested in catchswitches We had the right logic for the nested cleanuppad case but omitted it for catchswitches. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261615 91177308-0d34-0410-b5e6-96231b3b80d8 David Majnemer 4 years ago
2 changed file(s) with 63 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
253253 FuncInfo.FuncletBaseStateMap[CatchPad] = CatchLow;
254254 for (const User *U : CatchPad->users()) {
255255 const auto *UserI = cast(U);
256 if (auto *InnerCatchSwitch = dyn_cast(UserI))
257 if (InnerCatchSwitch->getUnwindDest() == CatchSwitch->getUnwindDest())
256 if (auto *InnerCatchSwitch = dyn_cast(UserI)) {
257 BasicBlock *UnwindDest = InnerCatchSwitch->getUnwindDest();
258 if (!UnwindDest || UnwindDest == CatchSwitch->getUnwindDest())
258259 calculateCXXStateNumbers(FuncInfo, UserI, CatchLow);
260 }
259261 if (auto *InnerCleanupPad = dyn_cast(UserI)) {
260262 BasicBlock *UnwindDest = getCleanupRetUnwindDest(InnerCleanupPad);
261263 // If a nested cleanup pad reports a null unwind destination and the
360362 // outside the __try.
361363 for (const User *U : CatchPad->users()) {
362364 const auto *UserI = cast(U);
363 if (auto *InnerCatchSwitch = dyn_cast(UserI))
364 if (InnerCatchSwitch->getUnwindDest() == CatchSwitch->getUnwindDest())
365 if (auto *InnerCatchSwitch = dyn_cast(UserI)) {
366 BasicBlock *UnwindDest = InnerCatchSwitch->getUnwindDest();
367 if (!UnwindDest || UnwindDest == CatchSwitch->getUnwindDest())
365368 calculateSEHStateNumbers(FuncInfo, UserI, ParentState);
369 }
366370 if (auto *InnerCleanupPad = dyn_cast(UserI)) {
367371 BasicBlock *UnwindDest = getCleanupRetUnwindDest(InnerCleanupPad);
368372 // If a nested cleanup pad reports a null unwind destination and the
0 ; RUN: llc < %s | FileCheck %s
1 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
2 target triple = "x86_64-pc-windows-msvc18.0.0"
3
4 ; Function Attrs: uwtable
5 define void @f() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
6 entry:
7 invoke void @g()
8 to label %try.cont unwind label %catch.dispatch
9
10 catch.dispatch: ; preds = %entry
11 %0 = catchswitch within none [label %catch] unwind label %ehcleanup
12
13 catch: ; preds = %catch.dispatch
14 %1 = catchpad within %0 [i8* null, i32 64, i8* null]
15 invoke void @g() [ "funclet"(token %1) ]
16 to label %dtor.exit unwind label %catch.dispatch.i
17
18 catch.dispatch.i: ; preds = %catch
19 %2 = catchswitch within %1 [label %catch.i] unwind to caller
20
21 catch.i: ; preds = %catch.dispatch.i
22 %3 = catchpad within %2 [i8* null, i32 64, i8* null]
23 catchret from %3 to label %dtor.exit
24
25 dtor.exit:
26 catchret from %1 to label %try.cont
27
28 try.cont:
29 ret void
30
31 ehcleanup: ; preds = %catch.dispatch
32 %4 = cleanuppad within none []
33 call void @dtor() #1 [ "funclet"(token %4) ]
34 cleanupret from %4 unwind to caller
35 }
36
37 declare void @g()
38
39 declare i32 @__CxxFrameHandler3(...)
40
41 ; Function Attrs: nounwind
42 declare void @dtor() #1
43
44 attributes #0 = { uwtable }
45 attributes #1 = { nounwind }
46
47 ; CHECK-LABEL: $ip2state$f:
48 ; CHECK: -1
49 ; CHECK: 1
50 ; CHECK: -1
51 ; CHECK: 4
52 ; CHECK: 2
53 ; CHECK: 3
54 ; CHECK: 2