Stackmap shadows should consider call returns a branch target.
[oota-llvm.git] / test / CodeGen / Mips / mips16ex.ll
1 ; RUN: llc  -march=mipsel -mcpu=mips16 -relocation-model=pic -O3 < %s | FileCheck %s -check-prefix=16
2
3 ;16: .cfi_personality
4 ;16-NEXT: [[TMP:.*]]:
5 ;16-NEXT: $eh_func_begin0 = ([[TMP]])
6 @.str = private unnamed_addr constant [7 x i8] c"hello\0A\00", align 1
7 @_ZTIi = external constant i8*
8 @.str1 = private unnamed_addr constant [15 x i8] c"exception %i \0A\00", align 1
9
10 define i32 @main() {
11 entry:
12   %retval = alloca i32, align 4
13   %exn.slot = alloca i8*
14   %ehselector.slot = alloca i32
15   %e = alloca i32, align 4
16   store i32 0, i32* %retval
17   %call = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([7 x i8]* @.str, i32 0, i32 0))
18   %exception = call i8* @__cxa_allocate_exception(i32 4) nounwind
19   %0 = bitcast i8* %exception to i32*
20   store i32 20, i32* %0
21   invoke void @__cxa_throw(i8* %exception, i8* bitcast (i8** @_ZTIi to i8*), i8* null) noreturn
22           to label %unreachable unwind label %lpad
23
24 lpad:                                             ; preds = %entry
25   %1 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
26           catch i8* bitcast (i8** @_ZTIi to i8*)
27   %2 = extractvalue { i8*, i32 } %1, 0
28   store i8* %2, i8** %exn.slot
29   %3 = extractvalue { i8*, i32 } %1, 1
30   store i32 %3, i32* %ehselector.slot
31   br label %catch.dispatch
32
33 catch.dispatch:                                   ; preds = %lpad
34   %sel = load i32* %ehselector.slot
35   %4 = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) nounwind
36   %matches = icmp eq i32 %sel, %4
37   br i1 %matches, label %catch, label %eh.resume
38
39 catch:                                            ; preds = %catch.dispatch
40   %exn = load i8** %exn.slot
41   %5 = call i8* @__cxa_begin_catch(i8* %exn) nounwind
42   %6 = bitcast i8* %5 to i32*
43   %exn.scalar = load i32* %6
44   store i32 %exn.scalar, i32* %e, align 4
45   %7 = load i32* %e, align 4
46   %call2 = invoke i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([15 x i8]* @.str1, i32 0, i32 0), i32 %7)
47           to label %invoke.cont unwind label %lpad1
48
49 invoke.cont:                                      ; preds = %catch
50   call void @__cxa_end_catch() nounwind
51   br label %try.cont
52
53 try.cont:                                         ; preds = %invoke.cont
54   ret i32 0
55
56 lpad1:                                            ; preds = %catch
57   %8 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
58           cleanup
59   %9 = extractvalue { i8*, i32 } %8, 0
60   store i8* %9, i8** %exn.slot
61   %10 = extractvalue { i8*, i32 } %8, 1
62   store i32 %10, i32* %ehselector.slot
63   call void @__cxa_end_catch() nounwind
64   br label %eh.resume
65
66 eh.resume:                                        ; preds = %lpad1, %catch.dispatch
67   %exn3 = load i8** %exn.slot
68   %sel4 = load i32* %ehselector.slot
69   %lpad.val = insertvalue { i8*, i32 } undef, i8* %exn3, 0
70   %lpad.val5 = insertvalue { i8*, i32 } %lpad.val, i32 %sel4, 1
71   resume { i8*, i32 } %lpad.val5
72
73 unreachable:                                      ; preds = %entry
74   unreachable
75 }
76
77 declare i32 @printf(i8*, ...)
78
79 declare i8* @__cxa_allocate_exception(i32)
80
81 declare i32 @__gxx_personality_v0(...)
82
83 declare void @__cxa_throw(i8*, i8*, i8*)
84
85 declare i32 @llvm.eh.typeid.for(i8*) nounwind readnone
86
87 declare i8* @__cxa_begin_catch(i8*)
88
89 declare void @__cxa_end_catch()