xref: /llvm-project/llvm/test/ExecutionEngine/MCJIT/remote/eh.ll (revision 5950a0623753a629814346ebadabbcda0ca2bdee)
1; REQUIRES: cxx-shared-library
2; RUN: %lli -jit-kind=mcjit -remote-mcjit -mcjit-remote-process=lli-child-target%exeext %s
3; XFAIL: target=arm{{.*}}, target={{.*-(cygwin|windows-msvc|windows-gnu)}}
4; REQUIRES: thread_support
5; UNSUPPORTED: target=powerpc64-unknown-linux-gnu
6; Remove UNSUPPORTED for powerpc64-unknown-linux-gnu if problem caused by r266663 is fixed
7; FIXME: Something hangs here.
8; UNSUPPORTED: use_msan_with_origins
9declare ptr @__cxa_allocate_exception(i64)
10declare void @__cxa_throw(ptr, ptr, ptr)
11declare i32 @__gxx_personality_v0(...)
12declare void @__cxa_end_catch()
13declare ptr @__cxa_begin_catch(ptr)
14
15@_ZTIi = external constant ptr
16
17define void @throwException() {
18  %exception = tail call ptr @__cxa_allocate_exception(i64 4)
19  call void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null)
20  unreachable
21}
22
23define i32 @main() personality ptr @__gxx_personality_v0 {
24entry:
25  invoke void @throwException()
26          to label %try.cont unwind label %lpad
27
28lpad:
29  %p = landingpad { ptr, i32 }
30          catch ptr @_ZTIi
31  %e = extractvalue { ptr, i32 } %p, 0
32  call ptr @__cxa_begin_catch(ptr %e)
33  call void @__cxa_end_catch()
34  br label %try.cont
35
36try.cont:
37  ret i32 0
38}
39