| 1 |
// Test the option to avoid failing if derived type descriptors are not found. |
| 2 |
// This is a debug option to allow manually writing derived type fir.embox without |
| 3 |
// having to care with providing an ABI compliant derived type descriptor object. |
| 4 |
// Missing derived type descriptor pointers are replaced by null pointers. |
| 5 |
// RUN: tco --ignore-missing-type-desc -o - %s | FileCheck %s |
| 6 |
// RUN: %flang_fc1 -emit-llvm -mmlir --ignore-missing-type-desc -o - %s | FileCheck %s |
| 7 |
|
| 8 |
!some_freestyle_type = !fir.type<some_not_mangled_type{j:i32}> |
| 9 |
|
| 10 |
func.func private @bar(!fir.box<!some_freestyle_type>) |
| 11 |
|
| 12 |
func.func @test_embox(%addr: !fir.ref<!some_freestyle_type>) { |
| 13 |
%0 = fir.embox %addr : (!fir.ref<!some_freestyle_type>) -> !fir.box<!some_freestyle_type> |
| 14 |
fir.call @bar(%0) : (!fir.box<!some_freestyle_type>) -> () |
| 15 |
return |
| 16 |
} |
| 17 |
// CHECK-LABEL: define void @test_embox( |
| 18 |
// CHECK-SAME: ptr {{[^%]*}}%[[ADDR:.*]]) |
| 19 |
// CHECK: insertvalue { ptr, i64, i32, i8, i8, i8, i8, ptr, [1 x i64] } |
| 20 |
// CHECK-SAME: { ptr undef, i64 4, |
| 21 |
// CHECK-SAME: i32 20240719, i8 0, i8 42, i8 0, i8 1, ptr null, [1 x i64] zeroinitializer }, |
| 22 |
// CHECK-SAME: ptr %[[ADDR]], 0 |