xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/catchret-empty-fallthrough.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -verify-machineinstrs < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; BranchFolding used to remove our empty landingpad block, which is
4*9880d681SAndroid Build Coastguard Worker; undesirable.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
7*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-pc-windows-msvc18.0.0"
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdeclare i32 @__C_specific_handler(...)
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdeclare void @bar()
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workerdefine void @foo(i1 %cond) personality i32 (...)* @__C_specific_handler {
14*9880d681SAndroid Build Coastguard Workerentry:
15*9880d681SAndroid Build Coastguard Worker  br i1 %cond, label %return, label %try
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Workertry:                                              ; preds = %entry
18*9880d681SAndroid Build Coastguard Worker  invoke void @bar()
19*9880d681SAndroid Build Coastguard Worker          to label %fallthrough unwind label %dispatch
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Workerdispatch:                                         ; preds = %try
22*9880d681SAndroid Build Coastguard Worker  %cs1 = catchswitch within none [label %catch] unwind to caller
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workercatch:                                            ; preds = %dispatch
25*9880d681SAndroid Build Coastguard Worker  %0 = catchpad within %cs1 [i8* null]
26*9880d681SAndroid Build Coastguard Worker  catchret from %0 to label %return
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerfallthrough:                                      ; preds = %try
29*9880d681SAndroid Build Coastguard Worker  unreachable
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workerreturn:                                           ; preds = %catch, %entry
32*9880d681SAndroid Build Coastguard Worker  ret void
33*9880d681SAndroid Build Coastguard Worker}
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: foo: # @foo
36*9880d681SAndroid Build Coastguard Worker; CHECK: testb $1, %cl
37*9880d681SAndroid Build Coastguard Worker; CHECK: je .LBB0_[[try:[0-9]+]]
38*9880d681SAndroid Build Coastguard Worker; CHECK: .LBB0_[[return:[0-9]+]]:
39*9880d681SAndroid Build Coastguard Worker; CHECK: retq
40*9880d681SAndroid Build Coastguard Worker; CHECK: .LBB0_[[try]]:
41*9880d681SAndroid Build Coastguard Worker; CHECK: .Ltmp0:
42*9880d681SAndroid Build Coastguard Worker; CHECK: callq bar
43*9880d681SAndroid Build Coastguard Worker; CHECK: .Ltmp1:
44*9880d681SAndroid Build Coastguard Worker; CHECK: .LBB0_[[catch:[0-9]+]]:
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard Worker; CHECK: .seh_handlerdata
47*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .Lfoo$parent_frame_offset = 32
48*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .long   (.Llsda_end0-.Llsda_begin0)/16
49*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .Llsda_begin0:
50*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .long   .Ltmp0@IMGREL+1
51*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .long   .Ltmp1@IMGREL+1
52*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .long   1
53*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .long   .LBB0_[[catch]]@IMGREL
54