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