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