1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=aarch64-apple-ios -verify-machineinstrs 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; This function tests that the machine verifier accepts an unconditional 4*9880d681SAndroid Build Coastguard Worker; branch from an invoke basic block, to its EH landing pad basic block. 5*9880d681SAndroid Build Coastguard Worker; The test is brittle and isn't ideally reduced, because in most cases the 6*9880d681SAndroid Build Coastguard Worker; branch would be removed (for instance, turned into a fallthrough), and in 7*9880d681SAndroid Build Coastguard Worker; that case, the machine verifier, which relies on analyzing branches for this 8*9880d681SAndroid Build Coastguard Worker; kind of verification, is unable to check anything, so accepts the CFG. 9*9880d681SAndroid Build Coastguard Worker 10*9880d681SAndroid Build Coastguard Workerdefine void @test_branch_to_landingpad() personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) { 11*9880d681SAndroid Build Coastguard Workerentry: 12*9880d681SAndroid Build Coastguard Worker br i1 undef, label %if.end50.thread, label %if.then6 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Workerlpad: 15*9880d681SAndroid Build Coastguard Worker %0 = landingpad { i8*, i32 } 16*9880d681SAndroid Build Coastguard Worker catch %struct._objc_typeinfo.12.129.194.285.350.493.519.532.571.597.623.765* @"OBJC_EHTYPE_$_NSString" 17*9880d681SAndroid Build Coastguard Worker catch %struct._objc_typeinfo.12.129.194.285.350.493.519.532.571.597.623.765* @OBJC_EHTYPE_id 18*9880d681SAndroid Build Coastguard Worker catch i8* null 19*9880d681SAndroid Build Coastguard Worker br i1 undef, label %invoke.cont33, label %catch.fallthrough 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Workercatch.fallthrough: 22*9880d681SAndroid Build Coastguard Worker %matches31 = icmp eq i32 undef, 0 23*9880d681SAndroid Build Coastguard Worker br i1 %matches31, label %invoke.cont41, label %finally.catchall 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Workerif.then6: 26*9880d681SAndroid Build Coastguard Worker invoke void @objc_exception_throw() 27*9880d681SAndroid Build Coastguard Worker to label %invoke.cont7 unwind label %lpad 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Workerinvoke.cont7: 30*9880d681SAndroid Build Coastguard Worker unreachable 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Workerif.end50.thread: 33*9880d681SAndroid Build Coastguard Worker tail call void (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str1, i64 0, i64 0), i32 125) 34*9880d681SAndroid Build Coastguard Worker tail call void (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str1, i64 0, i64 0), i32 128) 35*9880d681SAndroid Build Coastguard Worker unreachable 36*9880d681SAndroid Build Coastguard Worker 37*9880d681SAndroid Build Coastguard Workerinvoke.cont33: 38*9880d681SAndroid Build Coastguard Worker tail call void (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str1, i64 0, i64 0), i32 119) 39*9880d681SAndroid Build Coastguard Worker unreachable 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Workerinvoke.cont41: 42*9880d681SAndroid Build Coastguard Worker invoke void @objc_exception_rethrow() 43*9880d681SAndroid Build Coastguard Worker to label %invoke.cont43 unwind label %lpad40 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Workerinvoke.cont43: 46*9880d681SAndroid Build Coastguard Worker unreachable 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Workerlpad40: 49*9880d681SAndroid Build Coastguard Worker %1 = landingpad { i8*, i32 } 50*9880d681SAndroid Build Coastguard Worker catch i8* null 51*9880d681SAndroid Build Coastguard Worker br label %finally.catchall 52*9880d681SAndroid Build Coastguard Worker 53*9880d681SAndroid Build Coastguard Workerfinally.catchall: 54*9880d681SAndroid Build Coastguard Worker tail call void (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str1, i64 0, i64 0), i32 125) 55*9880d681SAndroid Build Coastguard Worker unreachable 56*9880d681SAndroid Build Coastguard Worker} 57*9880d681SAndroid Build Coastguard Worker 58*9880d681SAndroid Build Coastguard Worker%struct._objc_typeinfo.12.129.194.285.350.493.519.532.571.597.623.765 = type { i8**, i8*, %struct._class_t.10.127.192.283.348.491.517.530.569.595.621.764* } 59*9880d681SAndroid Build Coastguard Worker%struct._class_t.10.127.192.283.348.491.517.530.569.595.621.764 = type { %struct._class_t.10.127.192.283.348.491.517.530.569.595.621.764*, %struct._class_t.10.127.192.283.348.491.517.530.569.595.621.764*, %struct._objc_cache.0.117.182.273.338.481.507.520.559.585.611.754*, i8* (i8*, i8*)**, %struct._class_ro_t.9.126.191.282.347.490.516.529.568.594.620.763* } 60*9880d681SAndroid Build Coastguard Worker%struct._objc_cache.0.117.182.273.338.481.507.520.559.585.611.754 = type opaque 61*9880d681SAndroid Build Coastguard Worker%struct._class_ro_t.9.126.191.282.347.490.516.529.568.594.620.763 = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t.2.119.184.275.340.483.509.522.561.587.613.756*, %struct._objc_protocol_list.6.123.188.279.344.487.513.526.565.591.617.760*, %struct._ivar_list_t.8.125.190.281.346.489.515.528.567.593.619.762*, i8*, %struct._prop_list_t.4.121.186.277.342.485.511.524.563.589.615.758* } 62*9880d681SAndroid Build Coastguard Worker%struct.__method_list_t.2.119.184.275.340.483.509.522.561.587.613.756 = type { i32, i32, [0 x %struct._objc_method.1.118.183.274.339.482.508.521.560.586.612.755] } 63*9880d681SAndroid Build Coastguard Worker%struct._objc_method.1.118.183.274.339.482.508.521.560.586.612.755 = type { i8*, i8*, i8* } 64*9880d681SAndroid Build Coastguard Worker%struct._objc_protocol_list.6.123.188.279.344.487.513.526.565.591.617.760 = type { i64, [0 x %struct._protocol_t.5.122.187.278.343.486.512.525.564.590.616.759*] } 65*9880d681SAndroid Build Coastguard Worker%struct._protocol_t.5.122.187.278.343.486.512.525.564.590.616.759 = type { i8*, i8*, %struct._objc_protocol_list.6.123.188.279.344.487.513.526.565.591.617.760*, %struct.__method_list_t.2.119.184.275.340.483.509.522.561.587.613.756*, %struct.__method_list_t.2.119.184.275.340.483.509.522.561.587.613.756*, %struct.__method_list_t.2.119.184.275.340.483.509.522.561.587.613.756*, %struct.__method_list_t.2.119.184.275.340.483.509.522.561.587.613.756*, %struct._prop_list_t.4.121.186.277.342.485.511.524.563.589.615.758*, i32, i32, i8** } 66*9880d681SAndroid Build Coastguard Worker%struct._ivar_list_t.8.125.190.281.346.489.515.528.567.593.619.762 = type { i32, i32, [0 x %struct._ivar_t.7.124.189.280.345.488.514.527.566.592.618.761] } 67*9880d681SAndroid Build Coastguard Worker%struct._ivar_t.7.124.189.280.345.488.514.527.566.592.618.761 = type { i32*, i8*, i8*, i32, i32 } 68*9880d681SAndroid Build Coastguard Worker%struct._prop_list_t.4.121.186.277.342.485.511.524.563.589.615.758 = type { i32, i32, [0 x %struct._prop_t.3.120.185.276.341.484.510.523.562.588.614.757] } 69*9880d681SAndroid Build Coastguard Worker%struct._prop_t.3.120.185.276.341.484.510.523.562.588.614.757 = type { i8*, i8* } 70*9880d681SAndroid Build Coastguard Worker 71*9880d681SAndroid Build Coastguard Worker@.str1 = external unnamed_addr constant [17 x i8], align 1 72*9880d681SAndroid Build Coastguard Worker@OBJC_EHTYPE_id = external global %struct._objc_typeinfo.12.129.194.285.350.493.519.532.571.597.623.765 73*9880d681SAndroid Build Coastguard Worker@"OBJC_EHTYPE_$_NSString" = external global %struct._objc_typeinfo.12.129.194.285.350.493.519.532.571.597.623.765, section "__DATA,__datacoal_nt,coalesced", align 8 74*9880d681SAndroid Build Coastguard Worker 75*9880d681SAndroid Build Coastguard Workerdeclare void @objc_exception_throw() 76*9880d681SAndroid Build Coastguard Workerdeclare void @objc_exception_rethrow() 77*9880d681SAndroid Build Coastguard Workerdeclare i32 @__objc_personality_v0(...) 78*9880d681SAndroid Build Coastguard Workerdeclare void @printf(i8* nocapture readonly, ...) 79