1 ; RUN: llc -simplifycfg-require-and-preserve-domtree=1 < %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 ptr
7 declare void @_Z3foov() noreturn;
9 declare ptr @__cxa_allocate_exception(i32)
11 declare i32 @__gxx_personality_v0(...)
13 declare void @__cxa_throw(ptr, ptr, ptr)
15 declare void @__cxa_call_unexpected(ptr)
17 define i32 @main() personality ptr @__gxx_personality_v0 {
20 %exception.i = tail call ptr @__cxa_allocate_exception(i32 4) nounwind
21 store i32 42, ptr %exception.i, align 4
22 invoke void @__cxa_throw(ptr %exception.i, ptr @_ZTIi, ptr null) noreturn
23 to label %unreachable.i unwind label %lpad.i
25 lpad.i: ; preds = %entry
26 %0 = landingpad { ptr, i32 }
27 filter [1 x ptr] [ptr @_ZTIi]
29 ; CHECK: .long _ZTIi(target2) @ TypeInfo 1
30 ; CHECK: .long _ZTIi(target2) @ FilterInfo -1
31 %1 = extractvalue { ptr, i32 } %0, 1
32 %ehspec.fails.i = icmp slt i32 %1, 0
33 br i1 %ehspec.fails.i, label %ehspec.unexpected.i, label %lpad.body
35 ehspec.unexpected.i: ; preds = %lpad.i
36 %2 = extractvalue { ptr, i32 } %0, 0
37 invoke void @__cxa_call_unexpected(ptr %2) noreturn
38 to label %.noexc unwind label %lpad
40 .noexc: ; preds = %ehspec.unexpected.i
43 unreachable.i: ; preds = %entry
46 lpad: ; preds = %ehspec.unexpected.i
47 %3 = landingpad { ptr, i32 }
51 lpad.body: ; preds = %lpad.i, %lpad
52 %eh.lpad-body = phi { ptr, i32 } [ %3, %lpad ], [ %0, %lpad.i ]
53 %4 = extractvalue { ptr, i32 } %eh.lpad-body, 1
54 %5 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi) nounwind
55 %matches = icmp eq i32 %4, %5
56 br i1 %matches, label %try.cont, label %eh.resume
58 try.cont: ; preds = %lpad.body
59 %6 = extractvalue { ptr, i32 } %eh.lpad-body, 0
60 %7 = tail call ptr @__cxa_begin_catch(ptr %6) nounwind
61 tail call void @__cxa_end_catch() nounwind
64 eh.resume: ; preds = %lpad.body
65 resume { ptr, i32 } %eh.lpad-body
68 declare i32 @llvm.eh.typeid.for(ptr) nounwind readnone
70 declare ptr @__cxa_begin_catch(ptr)
72 declare void @__cxa_end_catch()