[flang-commits] [flang] cdc476a - [fir] Set !fir.len_param_index conversion to unimplemented
Diana Picus via flang-commits
flang-commits at lists.llvm.org
Tue Nov 23 04:22:23 PST 2021
Author: Diana Picus
Date: 2021-11-23T12:14:28Z
New Revision: cdc476ab2f7d4aaabdd220f94c6446afdb6a339d
URL: https://github.com/llvm/llvm-project/commit/cdc476ab2f7d4aaabdd220f94c6446afdb6a339d
DIFF: https://github.com/llvm/llvm-project/commit/cdc476ab2f7d4aaabdd220f94c6446afdb6a339d.diff
LOG: [fir] Set !fir.len_param_index conversion to unimplemented
This patch is part of the upstreaming effort from fir-dev.
The conversion of len_param_index in fir-dev is incomplete, so for now
we're marking this as unimplemented until we can settle on a design for
the runtime support of LEN parameters.
Differential Revision: https://reviews.llvm.org/D114241
Co-authored-by: Eric Schweitz <eschweitz at nvidia.com>
Added:
Modified:
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/test/Fir/convert-to-llvm-invalid.fir
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index 73c6f14dd28f8..1e1f3eefe4d72 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -827,6 +827,20 @@ struct GlobalLenOpConversion : public FIROpConversion<fir::GlobalLenOp> {
}
};
+/// Lower fir.len_param_index
+struct LenParamIndexOpConversion
+ : public FIROpConversion<fir::LenParamIndexOp> {
+ using FIROpConversion::FIROpConversion;
+
+ // FIXME: this should be specialized by the runtime target
+ mlir::LogicalResult
+ matchAndRewrite(fir::LenParamIndexOp lenp, OpAdaptor,
+ mlir::ConversionPatternRewriter &rewriter) const override {
+ return rewriter.notifyMatchFailure(
+ lenp, "fir.len_param_index codegen is not implemented yet");
+ }
+};
+
/// Lower `fir.gentypedesc` to a global constant.
struct GenTypeDescOpConversion : public FIROpConversion<fir::GenTypeDescOp> {
using FIROpConversion::FIROpConversion;
@@ -2179,14 +2193,15 @@ class FIRToLLVMLowering : public fir::FIRToLLVMLoweringBase<FIRToLLVMLowering> {
EmboxProcOpConversion, ExtractValueOpConversion, FieldIndexOpConversion,
FirEndOpConversion, HasValueOpConversion, GenTypeDescOpConversion,
GlobalLenOpConversion, GlobalOpConversion, InsertOnRangeOpConversion,
- InsertValueOpConversion, IsPresentOpConversion, LoadOpConversion,
- NegcOpConversion, NoReassocOpConversion, MulcOpConversion,
- SelectCaseOpConversion, SelectOpConversion, SelectRankOpConversion,
- SelectTypeOpConversion, ShapeOpConversion, ShapeShiftOpConversion,
- ShiftOpConversion, SliceOpConversion, StoreOpConversion,
- StringLitOpConversion, SubcOpConversion, UnboxCharOpConversion,
- UnboxProcOpConversion, UndefOpConversion, UnreachableOpConversion,
- ZeroOpConversion>(typeConverter);
+ InsertValueOpConversion, IsPresentOpConversion,
+ LenParamIndexOpConversion, LoadOpConversion, NegcOpConversion,
+ NoReassocOpConversion, MulcOpConversion, SelectCaseOpConversion,
+ SelectOpConversion, SelectRankOpConversion, SelectTypeOpConversion,
+ ShapeOpConversion, ShapeShiftOpConversion, ShiftOpConversion,
+ SliceOpConversion, StoreOpConversion, StringLitOpConversion,
+ SubcOpConversion, UnboxCharOpConversion, UnboxProcOpConversion,
+ UndefOpConversion, UnreachableOpConversion, ZeroOpConversion>(
+ typeConverter);
mlir::populateStdToLLVMConversionPatterns(typeConverter, pattern);
mlir::arith::populateArithmeticToLLVMConversionPatterns(typeConverter,
pattern);
diff --git a/flang/test/Fir/convert-to-llvm-invalid.fir b/flang/test/Fir/convert-to-llvm-invalid.fir
index c916c581083e5..248ca5eb4555f 100644
--- a/flang/test/Fir/convert-to-llvm-invalid.fir
+++ b/flang/test/Fir/convert-to-llvm-invalid.fir
@@ -86,6 +86,16 @@ fir.global @global_derived : !fir.type<minez(f:i32)> {
// -----
+// Test `fir.len_param_index` conversion failure. Not implemented yet.
+
+func @lenparamindex() {
+ // expected-error at +1{{failed to legalize operation 'fir.len_param_index'}}
+ %0 = fir.len_param_index l1, !fir.type<twolens(l1:i32, l2:i32){i:i32, f:f32, l:i64}>
+ return
+}
+
+// -----
+
// Test `fir.gentypedesc` conversion failure. Not implemented yet.
func @gentypedesc() {
More information about the flang-commits
mailing list