52 lines · plain
1; REQUIRES: system-darwin && host-unwind-supports-jit2; RUN: lli -jit-kind=orc %s3;4; Check that we can throw exceptions from no-fp functions. On systems that5; support compact-unwind this implicitly tests that we correctly handle6; unwind-info records that depend on DWARF FDEs.7 8@_ZTIi = external constant ptr9 10declare ptr @__cxa_allocate_exception(i64)11declare void @__cxa_throw(ptr, ptr, ptr)12declare ptr @__cxa_begin_catch(ptr)13declare void @__cxa_end_catch()14declare i32 @__gxx_personality_v0(...)15declare i32 @llvm.eh.typeid.for.p0(ptr)16 17define void @_Z3foov() "frame-pointer"="none" {18entry:19 %exception = tail call ptr @__cxa_allocate_exception(i64 4)20 store i32 42, ptr %exception21 tail call void @__cxa_throw(ptr %exception, ptr nonnull @_ZTIi, ptr null)22 unreachable23}24 25define i32 @main(i32 %argc, ptr %argv) "frame-pointer"="all" personality ptr @__gxx_personality_v0 {26entry:27 invoke void @_Z3foov()28 to label %return.unreachable unwind label %lpad29 30lpad:31 %0 = landingpad { ptr, i32 }32 catch ptr @_ZTIi33 %1 = extractvalue { ptr, i32 } %0, 134 %2 = tail call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIi)35 %matches = icmp eq i32 %1, %236 br i1 %matches, label %catch, label %eh.resume37 38catch:39 %3 = extractvalue { ptr, i32 } %0, 040 %4 = tail call ptr @__cxa_begin_catch(ptr %3)41 %5 = load i32, ptr %442 %sub = sub nsw i32 42, %543 tail call void @__cxa_end_catch()44 ret i32 %sub45 46return.unreachable:47 unreachable48 49eh.resume:50 resume { ptr, i32 } %051}52