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