62 lines · plain
1; Test for handlerdata when the function has landingpad and nounwind.2 3; This test case checks whether the handlerdata is generated for the function4; with landingpad instruction, even if the function has "nounwind" atttribute.5;6; For example, although the following function never throws any exception,7; however, it is still required to generate LSDA, otherwise, we can't catch8; the exception properly.9;10; void test1() noexcept {11; try {12; throw_exception();13; } catch (...) {14; }15; }16 17; RUN: llc -mtriple arm-unknown-linux-gnueabi -filetype=asm -o - %s \18; RUN: | FileCheck %s19 20declare void @throw_exception()21 22declare i32 @__gxx_personality_v0(...)23 24declare ptr @__cxa_begin_catch(ptr)25 26declare void @__cxa_end_catch()27 28define void @test1() nounwind personality ptr @__gxx_personality_v0 {29entry:30 invoke void @throw_exception() to label %try.cont unwind label %lpad31 32lpad:33 %0 = landingpad { ptr, i32 }34 catch ptr null35 %1 = extractvalue { ptr, i32 } %0, 036 %2 = tail call ptr @__cxa_begin_catch(ptr %1)37 tail call void @__cxa_end_catch()38 br label %try.cont39 40try.cont:41 ret void42}43 44; CHECK: .globl test145; CHECK: .p2align 246; CHECK: .type test1,%function47; CHECK-LABEL: test1:48; CHECK: .fnstart49 50; CHECK-NOT: .cantunwind51 52; CHECK: .personality __gxx_personality_v053; CHECK: .handlerdata54; CHECK: .p2align 255; CHECK-LABEL: GCC_except_table0:56; CHECK-LABEL: .Lexception0:57; CHECK: .byte 255 @ @LPStart Encoding = omit58; CHECK: .byte 0 @ @TType Encoding = absptr59; CHECK: .uleb128 .Lttbase60; CHECK: .byte 1 @ Call site Encoding = uleb12861; CHECK: .fnend62