[PATCH] D119325: [flang] Add type conversion for !fir.box<none>
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 9 05:25:58 PST 2022
clementval updated this revision to Diff 407126.
clementval marked 2 inline comments as done.
clementval added a comment.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Address comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119325/new/
https://reviews.llvm.org/D119325
Files:
flang/lib/Optimizer/CodeGen/TypeConverter.h
flang/test/Fir/types-to-llvm.fir
Index: flang/test/Fir/types-to-llvm.fir
===================================================================
--- flang/test/Fir/types-to-llvm.fir
+++ flang/test/Fir/types-to-llvm.fir
@@ -418,3 +418,11 @@
func private @foo1(%arg0: !fir.type<derived8{a:i64,b:!fir.box<i32>}>)
// CHECK-LABEL: foo1
// CHECK-SAME: !llvm.struct<"derived8", (i64, struct<(ptr<i32>, i{{.*}})>)>
+
+// -----
+
+// Test that fir.box<none>
+// `none` is used for polymorphic type.
+func private @foo0(%arg0: !fir.box<none>)
+// CHECK-LABEL: foo0
+// CHECK-SAME: !llvm.ptr<struct<(ptr<struct<()>>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}})>>)
Index: flang/lib/Optimizer/CodeGen/TypeConverter.h
===================================================================
--- flang/lib/Optimizer/CodeGen/TypeConverter.h
+++ flang/lib/Optimizer/CodeGen/TypeConverter.h
@@ -124,6 +124,10 @@
return mlir::LLVM::LLVMStructType::getLiteral(&getContext(), members,
/*isPacked=*/false);
});
+ addConversion([&](mlir::NoneType none) {
+ return mlir::LLVM::LLVMStructType::getLiteral(
+ none.getContext(), llvm::None, /*isPacked=*/false);
+ });
}
// i32 is used here because LLVM wants i32 constants when indexing into struct
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119325.407126.patch
Type: text/x-patch
Size: 1286 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220209/4d0de695/attachment.bin>
More information about the llvm-commits
mailing list