xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/catchret-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; We used to have an issue where we inserted an MBB between invoke.cont.3 and
4*9880d681SAndroid Build Coastguard Worker; its fallthrough target of ret void.
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
7*9880d681SAndroid Build Coastguard Workertarget triple = "i386-pc-windows-msvc18.0.0"
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker@some_global = global i32 0
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdeclare i32 @__CxxFrameHandler3(...)
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Workerdeclare void @g()
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerdefine void @f() personality i32 (...)* @__CxxFrameHandler3 {
16*9880d681SAndroid Build Coastguard Workerentry:
17*9880d681SAndroid Build Coastguard Worker  invoke void @g()
18*9880d681SAndroid Build Coastguard Worker          to label %invoke.cont.3 unwind label %catch.dispatch
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workercatch.dispatch:                                   ; preds = %entry
21*9880d681SAndroid Build Coastguard Worker  %cs1 = catchswitch within none [label %catch] unwind to caller
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workercatch:                                            ; preds = %catch.dispatch
24*9880d681SAndroid Build Coastguard Worker  %0 = catchpad within %cs1 [i8* null, i32 64, i8* null]
25*9880d681SAndroid Build Coastguard Worker  catchret from %0 to label %nrvo.skipdtor
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerinvoke.cont.3:                                    ; preds = %entry
28*9880d681SAndroid Build Coastguard Worker  store i32 123, i32* @some_global
29*9880d681SAndroid Build Coastguard Worker  br label %nrvo.skipdtor
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workernrvo.skipdtor:                                    ; preds = %invoke.cont.3, %invoke.cont.4
32*9880d681SAndroid Build Coastguard Worker  ret void
33*9880d681SAndroid Build Coastguard Worker}
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: _f: # @f
36*9880d681SAndroid Build Coastguard Worker; CHECK: calll _g
37*9880d681SAndroid Build Coastguard Worker; CHECK: movl $123, _some_global
38*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: jmp
39*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: movl {{.*}}, %esp
40*9880d681SAndroid Build Coastguard Worker; CHECK: retl
41*9880d681SAndroid Build Coastguard Worker; CHECK: addl $12, %ebp
42*9880d681SAndroid Build Coastguard Worker; CHECK: jmp LBB0_{{.*}}
43