diff --git a/flang/lib/Optimizer/CodeGen/TypeConverter.h b/flang/lib/Optimizer/CodeGen/TypeConverter.h --- a/flang/lib/Optimizer/CodeGen/TypeConverter.h +++ b/flang/lib/Optimizer/CodeGen/TypeConverter.h @@ -52,6 +52,7 @@ addConversion([&](BoxType box) { return convertBoxType(box); }); addConversion( [&](fir::CharacterType charTy) { return convertCharType(charTy); }); + addConversion([&](HeapType heap) { return convertPointerLike(heap); }); addConversion([&](fir::LogicalType boolTy) { return mlir::IntegerType::get( &getContext(), kindMapping.getLogicalBitsize(boolTy.getFKind())); diff --git a/flang/test/Fir/types-to-llvm.fir b/flang/test/Fir/types-to-llvm.fir --- a/flang/test/Fir/types-to-llvm.fir +++ b/flang/test/Fir/types-to-llvm.fir @@ -28,6 +28,9 @@ func private @foo1(%arg0: !fir.ref>) // CHECK-LABEL: foo1 // CHECK-SAME: !llvm.ptr> +func private @foo2(%arg0: !fir.ref>>>) +// CHECK-LABEL: foo2 +// CHECK-SAME: !llvm.ptr>, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)>> // ----- @@ -61,6 +64,10 @@ // CHECK-LABEL: foo3 // CHECK-SAME: !llvm.ptr>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr, array<1 x i{{.*}}>)>> +func private @foo4(%arg0: !fir.box>>) +// CHECK-LABEL: foo4 +// CHECK-SAME: !llvm.ptr>, i64, i32, i8, i8, i8, i8, ptr, array<1 x i64>)>> + // ----- // Test char types `!fir.char` @@ -82,6 +89,45 @@ // ----- +// Test `!fir.heap<>` conversion. +func private @foo0(%arg0: !fir.heap) +// CHECK-LABEL: foo0 +// CHECK-SAME: !llvm.ptr + +func private @foo1(%arg0: !fir.heap>) +// CHECK-LABEL: foo1 +// CHECK-SAME: !llvm.ptr> + +func private @foo2(%arg0: !fir.heap>) +// CHECK-LABEL: foo2 +// CHECK-SAME: !llvm.ptr + +func private @foo3(%arg0: !fir.heap>) +// CHECK-LABEL: foo3 +// CHECK-SAME: !llvm.ptr> + +func private @foo4(%arg0: !fir.heap>) +// CHECK-LABEL: foo4 +// CHECK-SAME: !llvm.ptr + +func private @foo5(%arg0: !fir.heap>) +// CHECK-LABEL: foo5 +// CHECK-SAME: !llvm.ptr> + +func private @foo6(%arg0: !fir.heap>) +// CHECK-LABEL: foo6 +// CHECK-SAME: !llvm.ptr + +func private @foo7(%arg0: !fir.heap>) +// CHECK-LABEL: foo7 +// CHECK-SAME: !llvm.ptr> + +func private @foo8(%arg0: !fir.heap>) +// CHECK-LABEL: foo8 +// CHECK-SAME: !llvm.ptr> + +// ----- + // Test `!fir.logical` conversion. func private @foo0(%arg0: !fir.logical<1>)