1 ; RUN: opt -sjljehprepare -verify < %s -S | FileCheck %s
2 target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
3 target triple = "armv7s-apple-ios7.0"
5 %swift.error = type opaque
7 declare void @objc_msgSend() local_unnamed_addr
9 declare i32 @__objc_personality_v0(...)
11 ; Make sure we don't leave a select on a swifterror argument.
13 ; CHECK-NOT: select true, %0
14 define swiftcc void @test(%swift.error** swifterror) local_unnamed_addr personality i32 (...)* @__objc_personality_v0 {
16 %call28.i = invoke i32 bitcast (void ()* @objc_msgSend to i32 (i8*, i8*)*)(i8* undef, i8* undef)
17 to label %invoke.cont.i unwind label %lpad.i
23 %1 = landingpad { i8*, i32 }
25 resume { i8*, i32 } undef
28 %struct._objc_typeinfo = type { i8**, i8*, i64* }
29 @"OBJC_EHTYPE_$_NSException" = external global %struct._objc_typeinfo
31 ; Make sure this does not crash.
32 ; CHECK-LABEL: @swift_error_bug
33 ; CHECK: store %swift.error* null, %swift.error** %0
35 define hidden swiftcc void @swift_error_bug(%swift.error** swifterror, void (i8*)** %fun, i1 %b) local_unnamed_addr #0 personality i32 (...)* @__objc_personality_v0 {
36 %2 = load void (i8*)*, void (i8*)** %fun, align 4
37 invoke void %2(i8* null) #1
38 to label %tryBlock.exit unwind label %3, !clang.arc.no_objc_arc_exceptions !1
41 %4 = landingpad { i8*, i32 }
42 catch %struct._objc_typeinfo* @"OBJC_EHTYPE_$_NSException"
43 br label %tryBlock.exit
46 br i1 %b, label %5, label %_T0ypMa.exit.i.i
49 store %swift.error* null, %swift.error** %0, align 4