45 lines · plain
1; RUN: opt -p sjlj-eh-prepare %s -S -o - | FileCheck %s2 3; Check that callsites are set up correctly:4; 1. Throwing call in the entry block does not set call_site5; (function context hasn't been configured yet).6; 2. Throwing call not in the entry block sets call_site to -17; (reset to the initial state).8; 3. Invoke instructions set call_site to the correct call site number.9; 4. Resume instruction sets call_site to -1 (reset to the initial state).10 11define void @test_call_sites() personality ptr @__gxx_personality_sj0 {12entry:13 ; CHECK-NOT: store volatile14 ; CHECK: call void @may_throw()15 call void @may_throw()16 17 ; CHECK: store volatile i32 118 ; CHECK-NEXT: call void @llvm.eh.sjlj.callsite(i32 1)19 ; CHECK-NEXT: invoke void @may_throw()20 invoke void @may_throw() to label %invoke.cont unwind label %lpad21 22invoke.cont:23 ; CHECK: store volatile i32 224 ; CHECK-NEXT: call void @llvm.eh.sjlj.callsite(i32 2)25 ; CHECK-NEXT: invoke void @may_throw()26 invoke void @may_throw() to label %try.cont unwind label %lpad27 28lpad:29 ; CHECK: store volatile i32 -130 ; CHECK-NEXT: resume31 %lp = landingpad { ptr, i32 } catch ptr @type_info32 resume { ptr, i32 } %lp33 34try.cont:35 ; CHECK: store volatile i32 -136 ; CHECK-NEXT: call void @may_throw37 call void @may_throw()38 ret void39}40 41@type_info = external constant ptr42 43declare void @may_throw()44declare i32 @__gxx_personality_sj0(...)45