1 ; RUN: llc < %s | FileCheck %s
2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S64"
3 target triple = "armv7-none-linux-gnueabi"
5 @_ZTIi = external constant i8*
7 declare void @_Z3foov() noreturn;
9 declare i8* @__cxa_allocate_exception(i32)
11 declare i32 @__gxx_personality_v0(...)
13 declare void @__cxa_throw(i8*, i8*, i8*)
15 declare void @__cxa_call_unexpected(i8*)
17 define i32 @main() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
20 %exception.i = tail call i8* @__cxa_allocate_exception(i32 4) nounwind
21 %0 = bitcast i8* %exception.i to i32*
22 store i32 42, i32* %0, align 4
23 invoke void @__cxa_throw(i8* %exception.i, i8* bitcast (i8** @_ZTIi to i8*), i8* null) noreturn
24 to label %unreachable.i unwind label %lpad.i
26 lpad.i: ; preds = %entry
27 %1 = landingpad { i8*, i32 }
28 filter [1 x i8*] [i8* bitcast (i8** @_ZTIi to i8*)]
29 catch i8* bitcast (i8** @_ZTIi to i8*)
30 ; CHECK: .long _ZTIi(target2) @ TypeInfo 1
31 ; CHECK: .long _ZTIi(target2) @ FilterInfo -1
32 %2 = extractvalue { i8*, i32 } %1, 1
33 %ehspec.fails.i = icmp slt i32 %2, 0
34 br i1 %ehspec.fails.i, label %ehspec.unexpected.i, label %lpad.body
36 ehspec.unexpected.i: ; preds = %lpad.i
37 %3 = extractvalue { i8*, i32 } %1, 0
38 invoke void @__cxa_call_unexpected(i8* %3) noreturn
39 to label %.noexc unwind label %lpad
41 .noexc: ; preds = %ehspec.unexpected.i
44 unreachable.i: ; preds = %entry
47 lpad: ; preds = %ehspec.unexpected.i
48 %4 = landingpad { i8*, i32 }
49 catch i8* bitcast (i8** @_ZTIi to i8*)
52 lpad.body: ; preds = %lpad.i, %lpad
53 %eh.lpad-body = phi { i8*, i32 } [ %4, %lpad ], [ %1, %lpad.i ]
54 %5 = extractvalue { i8*, i32 } %eh.lpad-body, 1
55 %6 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) nounwind
56 %matches = icmp eq i32 %5, %6
57 br i1 %matches, label %try.cont, label %eh.resume
59 try.cont: ; preds = %lpad.body
60 %7 = extractvalue { i8*, i32 } %eh.lpad-body, 0
61 %8 = tail call i8* @__cxa_begin_catch(i8* %7) nounwind
62 tail call void @__cxa_end_catch() nounwind
65 eh.resume: ; preds = %lpad.body
66 resume { i8*, i32 } %eh.lpad-body
69 declare i32 @llvm.eh.typeid.for(i8*) nounwind readnone
71 declare i8* @__cxa_begin_catch(i8*)
73 declare void @__cxa_end_catch()