54 lines · plain
1// RUN: cir-opt %s -cir-to-llvm -o %t.cir2 3!u8i = !cir.int<u, 8>4 5module {6 7// CHECK: llvm.func @__gxx_personality_v0(...) -> i328 9cir.func @inflight_exception() {10 %exception_ptr, %type_id = cir.eh.inflight_exception11 cir.return12}13 14// CHECK: llvm.func @inflight_exception() attributes {personality = @__gxx_personality_v0} {15// CHECK: %[[CONST_0:.*]] = llvm.mlir.zero : !llvm.ptr16// CHECK: %[[LP:.*]] = llvm.landingpad (catch %[[CONST_0]] : !llvm.ptr) : !llvm.struct<(ptr, i32)>17// CHECK: %[[EXCEPTION_PTR:.*]] = llvm.extractvalue %[[LP]][0] : !llvm.struct<(ptr, i32)> 18// CHECK: %[[TYPE_ID:.*]] = llvm.extractvalue %[[LP]][1] : !llvm.struct<(ptr, i32)> 19// CHECK: llvm.return20// CHECK: }21 22cir.func @inflight_exception_with_cleanup() {23 %exception_ptr, %type_id = cir.eh.inflight_exception cleanup24 cir.return25}26 27// CHECK: llvm.func @inflight_exception_with_cleanup() attributes {personality = @__gxx_personality_v0} {28// CHECK: %[[LP:.*]] = llvm.landingpad cleanup : !llvm.struct<(ptr, i32)>29// CHECK: %[[EXCEPTION_PTR:.*]] = llvm.extractvalue %[[LP]][0] : !llvm.struct<(ptr, i32)> 30// CHECK: %[[TYPE_ID:.*]] = llvm.extractvalue %[[LP]][1] : !llvm.struct<(ptr, i32)> 31// CHECK: llvm.return32// CHECK: }33 34 35cir.global "private" constant external @_ZTIi : !cir.ptr<!u8i>36cir.global "private" constant external @_ZTIPKc : !cir.ptr<!u8i>37 38cir.func @inflight_exception_with_catch_type_list() {39 %exception_ptr, %type_id = cir.eh.inflight_exception [@_ZTIi, @_ZTIPKc]40 cir.return41}42 43// CHECK: llvm.func @inflight_exception_with_catch_type_list() attributes {personality = @__gxx_personality_v0} {44// CHECK: %[[TI_1_ADDR:.*]] = llvm.mlir.addressof @_ZTIPKc : !llvm.ptr45// CHECK: %[[TI_2_ADDR:.*]] = llvm.mlir.addressof @_ZTIi : !llvm.ptr46// CHECK: %[[LP:.*]] = llvm.landingpad (catch %[[TI_2_ADDR]] : !llvm.ptr) (catch %[[TI_1_ADDR]] : !llvm.ptr) : !llvm.struct<(ptr, i32)>47// CHECK: %[[EXCEPTION_PTR:.*]] = llvm.extractvalue %[[LP]][0] : !llvm.struct<(ptr, i32)> 48// CHECK: %[[TYPE_ID:.*]] = llvm.extractvalue %[[LP]][1] : !llvm.struct<(ptr, i32)> 49// CHECK: llvm.return50// CHECK: }51 52 53}54