xref: /aosp_15_r20/external/llvm/test/Transforms/Sink/catchswitch.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -sink -S < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
4*9880d681SAndroid Build Coastguard Workertarget triple = "i686-pc-windows-msvc"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine void @h() personality i32 (...)* @__CxxFrameHandler3 {
7*9880d681SAndroid Build Coastguard Workerentry:
8*9880d681SAndroid Build Coastguard Worker  %call = call i32 @g(i32 1) readnone
9*9880d681SAndroid Build Coastguard Worker  invoke void @_CxxThrowException(i8* null, i8* null) noreturn
10*9880d681SAndroid Build Coastguard Worker          to label %unreachable unwind label %catch.dispatch
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workercatch.dispatch:                                   ; preds = %entry
13*9880d681SAndroid Build Coastguard Worker  %cs = catchswitch within none [label %catch] unwind to caller
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workercatch:                                            ; preds = %catch.dispatch
16*9880d681SAndroid Build Coastguard Worker  %cp = catchpad within %cs [i8* null, i32 64, i8* null]
17*9880d681SAndroid Build Coastguard Worker  catchret from %cp to label %try.cont
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workertry.cont:                                         ; preds = %catch
20*9880d681SAndroid Build Coastguard Worker  call void @k(i32 %call)
21*9880d681SAndroid Build Coastguard Worker  ret void
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerunreachable:                                      ; preds = %entry
24*9880d681SAndroid Build Coastguard Worker  unreachable
25*9880d681SAndroid Build Coastguard Worker}
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerdeclare x86_stdcallcc void @_CxxThrowException(i8*, i8*)
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Workerdeclare i32 @__CxxFrameHandler3(...)
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workerdeclare i32 @g(i32) readnone
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Workerdeclare void @k(i32)
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: define void @h(
36*9880d681SAndroid Build Coastguard Worker; CHECK: call i32 @g(i32 1)
37*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: invoke void @_CxxThrowException(
38