[flang-commits] [flang] 003c9c7 - Revert "[Flang] Replace notifyMatchFailure with TODO hard failures"

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Wed Dec 1 06:24:20 PST 2021


Author: Kiran Chandramohan
Date: 2021-12-01T14:23:48Z
New Revision: 003c9c7457d08888be5deeca7eee84ab5f110bf6

URL: https://github.com/llvm/llvm-project/commit/003c9c7457d08888be5deeca7eee84ab5f110bf6
DIFF: https://github.com/llvm/llvm-project/commit/003c9c7457d08888be5deeca7eee84ab5f110bf6.diff

LOG: Revert "[Flang] Replace notifyMatchFailure with TODO hard failures"

This reverts commit 46fd7fd7b342039b59ec534bab8b93fa5d34f6e2.

Added: 
    

Modified: 
    flang/lib/Optimizer/CodeGen/CodeGen.cpp
    flang/test/CMakeLists.txt
    flang/test/Fir/convert-to-llvm-invalid.fir
    flang/test/lit.cfg.py

Removed: 
    flang/test/Fir/Todo/boxproc_host.fir
    flang/test/Fir/Todo/dispatch.fir
    flang/test/Fir/Todo/dispatch_table.fir
    flang/test/Fir/Todo/emboxproc.fir
    flang/test/Fir/Todo/end.fir
    flang/test/Fir/Todo/gentypedesc.fir
    flang/test/Fir/Todo/global_len.fir
    flang/test/Fir/Todo/len_param_index.fir
    flang/test/Fir/Todo/select_case_with_character.fir
    flang/test/Fir/Todo/unboxproc.fir


################################################################################
diff  --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index 4df7014e0b342..7583d5dfcabb4 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -541,8 +541,8 @@ struct BoxProcHostOpConversion : public FIROpConversion<fir::BoxProcHostOp> {
   mlir::LogicalResult
   matchAndRewrite(fir::BoxProcHostOp boxprochost, OpAdaptor adaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    TODO(boxprochost.getLoc(), "fir.boxproc_host codegen");
-    return failure();
+    return rewriter.notifyMatchFailure(
+        boxprochost, "fir.boxproc_host codegen is not implemented yet");
   }
 };
 
@@ -783,8 +783,8 @@ struct DispatchOpConversion : public FIROpConversion<fir::DispatchOp> {
   mlir::LogicalResult
   matchAndRewrite(fir::DispatchOp dispatch, OpAdaptor adaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    TODO(dispatch.getLoc(), "fir.dispatch codegen");
-    return failure();
+    return rewriter.notifyMatchFailure(
+        dispatch, "fir.dispatch codegen is not implemented yet");
   }
 };
 
@@ -797,8 +797,8 @@ struct DispatchTableOpConversion
   mlir::LogicalResult
   matchAndRewrite(fir::DispatchTableOp dispTab, OpAdaptor adaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    TODO(dispTab.getLoc(), "fir.dispatch_table codegen");
-    return failure();
+    return rewriter.notifyMatchFailure(
+        dispTab, "fir.dispatch_table codegen is not implemented yet");
   }
 };
 
@@ -810,8 +810,8 @@ struct DTEntryOpConversion : public FIROpConversion<fir::DTEntryOp> {
   mlir::LogicalResult
   matchAndRewrite(fir::DTEntryOp dtEnt, OpAdaptor adaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    TODO(dtEnt.getLoc(), "fir.dt_entry codegen");
-    return failure();
+    return rewriter.notifyMatchFailure(
+        dtEnt, "fir.dt_entry codegen is not implemented yet");
   }
 };
 
@@ -822,8 +822,8 @@ struct GlobalLenOpConversion : public FIROpConversion<fir::GlobalLenOp> {
   mlir::LogicalResult
   matchAndRewrite(fir::GlobalLenOp globalLen, OpAdaptor adaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    TODO(globalLen.getLoc(), "fir.global_len codegen");
-    return failure();
+    return rewriter.notifyMatchFailure(
+        globalLen, "fir.global_len codegen is not implemented yet");
   }
 };
 
@@ -836,7 +836,8 @@ struct LenParamIndexOpConversion
   mlir::LogicalResult
   matchAndRewrite(fir::LenParamIndexOp lenp, OpAdaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    TODO(lenp.getLoc(), "fir.len_param_index codegen");
+    return rewriter.notifyMatchFailure(
+        lenp, "fir.len_param_index codegen is not implemented yet");
   }
 };
 
@@ -847,8 +848,8 @@ struct GenTypeDescOpConversion : public FIROpConversion<fir::GenTypeDescOp> {
   mlir::LogicalResult
   matchAndRewrite(fir::GenTypeDescOp gentypedesc, OpAdaptor adaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    TODO(gentypedesc.getLoc(), "fir.gentypedesc codegen");
-    return failure();
+    return rewriter.notifyMatchFailure(
+        gentypedesc, "fir.fir.gentypedesc codegen is not implemented yet");
   }
 };
 
@@ -859,8 +860,8 @@ struct FirEndOpConversion : public FIROpConversion<fir::FirEndOp> {
   mlir::LogicalResult
   matchAndRewrite(fir::FirEndOp firEnd, OpAdaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    TODO(firEnd.getLoc(), "fir.end codegen");
-    return failure();
+    return rewriter.notifyMatchFailure(
+        firEnd, "fir.end codegen is not implemented yet");
   }
 };
 
@@ -1020,11 +1021,11 @@ struct SelectCaseOpConversion : public FIROpConversion<fir::SelectCaseOp> {
     unsigned conds = caseOp.getNumConditions();
     llvm::ArrayRef<mlir::Attribute> cases = caseOp.getCases().getValue();
     // Type can be CHARACTER, INTEGER, or LOGICAL (C1145)
-    auto ty = caseOp.getSelector().getType();
-    if (ty.isa<fir::CharacterType>()) {
-      TODO(caseOp.getLoc(), "fir.select_case codegen with character type");
-      return failure();
-    }
+    LLVM_ATTRIBUTE_UNUSED auto ty = caseOp.getSelector().getType();
+    if (ty.isa<fir::CharacterType>())
+      return rewriter.notifyMatchFailure(caseOp,
+                                         "conversion of fir.select_case with "
+                                         "character type not implemented yet");
     mlir::Value selector = caseOp.getSelector(adaptor.getOperands());
     auto loc = caseOp.getLoc();
     for (unsigned t = 0; t != conds; ++t) {
@@ -1181,9 +1182,8 @@ struct SelectTypeOpConversion : public FIROpConversion<fir::SelectTypeOp> {
   mlir::LogicalResult
   matchAndRewrite(fir::SelectTypeOp select, OpAdaptor adaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    mlir::emitError(select.getLoc(),
-                    "fir.select_type should have already been converted");
-    return failure();
+    return rewriter.notifyMatchFailure(
+        select, "fir.select_type codegen is not implemented yet");
   }
 };
 
@@ -1254,7 +1254,7 @@ struct ZeroOpConversion : public FIROpConversion<fir::ZeroOp> {
   mlir::LogicalResult
   matchAndRewrite(fir::ZeroOp zero, OpAdaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    mlir::Type ty = convertType(zero.getType());
+    auto ty = convertType(zero.getType());
     if (ty.isa<mlir::LLVM::LLVMPointerType>()) {
       rewriter.replaceOpWithNewOp<mlir::LLVM::NullOp>(zero, ty);
     } else if (ty.isa<mlir::IntegerType>()) {
@@ -1575,11 +1575,10 @@ struct EmboxOpConversion : public EmboxCommonConversion<fir::EmboxOp> {
                              /*lenParams=*/adaptor.getOperands().drop_front(1));
     dest = insertBaseAddress(rewriter, embox.getLoc(), dest,
                              adaptor.getOperands()[0]);
-    if (isDerivedTypeWithLenParams(boxTy)) {
-      TODO(embox.getLoc(),
-           "fir.embox codegen of derived with length parameters");
-      return failure();
-    }
+    if (isDerivedTypeWithLenParams(boxTy))
+      return rewriter.notifyMatchFailure(
+          embox, "fir.embox codegen of derived with length parameters not "
+                 "implemented yet");
     auto result = placeInMemoryIfNotGlobalInit(rewriter, embox.getLoc(), dest);
     rewriter.replaceOp(embox, result);
     return success();
@@ -1594,11 +1593,12 @@ struct EmboxProcOpConversion : public FIROpConversion<fir::EmboxProcOp> {
   mlir::LogicalResult
   matchAndRewrite(fir::EmboxProcOp emboxproc, OpAdaptor adaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    TODO(emboxproc.getLoc(), "fir.emboxproc codegen");
-    return failure();
+    return rewriter.notifyMatchFailure(
+        emboxproc, "fir.emboxproc codegen is not implemented yet");
   }
 };
 
+
 // Code shared between insert_value and extract_value Ops.
 struct ValueOpCommon {
   // Translate the arguments pertaining to any multidimensional array to
@@ -2110,8 +2110,8 @@ struct UnboxProcOpConversion : public FIROpConversion<fir::UnboxProcOp> {
   mlir::LogicalResult
   matchAndRewrite(fir::UnboxProcOp unboxproc, OpAdaptor adaptor,
                   mlir::ConversionPatternRewriter &rewriter) const override {
-    TODO(unboxproc.getLoc(), "fir.unboxproc codegen");
-    return failure();
+    return rewriter.notifyMatchFailure(
+        unboxproc, "fir.unboxproc codegen is not implemented yet");
   }
 };
 

diff  --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt
index 07cb01af975a3..5b1f41e8868e9 100644
--- a/flang/test/CMakeLists.txt
+++ b/flang/test/CMakeLists.txt
@@ -46,7 +46,7 @@ set(FLANG_TEST_PARAMS
   flang_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py)
 
 set(FLANG_TEST_DEPENDS
-  flang-new llvm-config FileCheck count not module_files fir-opt tco
+  flang-new FileCheck count not module_files fir-opt tco
 )
 
 if (FLANG_INCLUDE_TESTS)

diff  --git a/flang/test/Fir/Todo/boxproc_host.fir b/flang/test/Fir/Todo/boxproc_host.fir
deleted file mode 100644
index a4cba400d1b57..0000000000000
--- a/flang/test/Fir/Todo/boxproc_host.fir
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: not fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s
-
-// Test that `fir.boxproc_host` fails conversion to llvm.
-// At the moment this test fails since `fir.boxproc` type does not have a conversion.
-
-// CHECK: failed to legalize operation 'builtin.func'
-func @test(%bproc: !fir.boxproc<(i32) -> ()>) {
-  %tuple = fir.boxproc_host %bproc : (!fir.boxproc<(i32) -> ()>) -> (!fir.ref<tuple<i32,f64>>)
-  return
-}

diff  --git a/flang/test/Fir/Todo/dispatch.fir b/flang/test/Fir/Todo/dispatch.fir
deleted file mode 100644
index f98ee2fb40fef..0000000000000
--- a/flang/test/Fir/Todo/dispatch.fir
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s
-
-// Test `fir.dispatch` conversion to llvm.
-// Not implemented yet.
-            
-func @dispatch(%arg0: !fir.box<!fir.type<derived3{f:f32}>>) {
-// CHECK: not yet implemented fir.dispatch codegen
-  %0 = fir.dispatch "method"(%arg0) : (!fir.box<!fir.type<derived3{f:f32}>>) -> i32
-  return    
-}

diff  --git a/flang/test/Fir/Todo/dispatch_table.fir b/flang/test/Fir/Todo/dispatch_table.fir
deleted file mode 100644
index e62b2c038a89c..0000000000000
--- a/flang/test/Fir/Todo/dispatch_table.fir
+++ /dev/null
@@ -1,9 +0,0 @@
-// RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s
-
-// Test fir.dispatch_table conversion to llvm.
-// Not implemented yet.
-
-// CHECK: not yet implemented fir.dispatch_table codegen
-fir.dispatch_table @dispatch_tbl {
-  fir.dt_entry "method", @method_impl
-}

diff  --git a/flang/test/Fir/Todo/emboxproc.fir b/flang/test/Fir/Todo/emboxproc.fir
deleted file mode 100644
index c16e7a1925f41..0000000000000
--- a/flang/test/Fir/Todo/emboxproc.fir
+++ /dev/null
@@ -1,11 +0,0 @@
-// RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s
-
-// Test `fir.emboxproc` conversion to llvm.
-// Not implemented yet.
-
-func @emboxproc_test() {
-  %host_vars = fir.alloca tuple<i32,f64>
-// CHECK: not yet implemented fir.emboxproc codegen
-  %bproc = fir.emboxproc @method_impl, %host_vars : ((i32) -> (), !fir.ref<tuple<i32,f64>>) -> !fir.boxproc<(i32) -> ()>
-  return
-}

diff  --git a/flang/test/Fir/Todo/end.fir b/flang/test/Fir/Todo/end.fir
deleted file mode 100644
index ecf01b57b6cbc..0000000000000
--- a/flang/test/Fir/Todo/end.fir
+++ /dev/null
@@ -1,9 +0,0 @@
-// RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s
-
-// Test `fir.end` conversion to llvm.
-// Not implemented yet.
-
-func @end_test() {
-// CHECK: not yet implemented fir.end codegen
-  "fir.end"() : () -> ()
-}

diff  --git a/flang/test/Fir/Todo/gentypedesc.fir b/flang/test/Fir/Todo/gentypedesc.fir
deleted file mode 100644
index 1060d0dabed4c..0000000000000
--- a/flang/test/Fir/Todo/gentypedesc.fir
+++ /dev/null
@@ -1,10 +0,0 @@
-// RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s
-
-// Test `fir.gentypedesc` conversion to llvm.
-// Not implemented yet.
-
-func @gentypedesc() {
-// CHECK: not yet implemented fir.gentypedesc codegen
-  %0 = fir.gentypedesc !fir.type<derived3>
-  return
-}

diff  --git a/flang/test/Fir/Todo/global_len.fir b/flang/test/Fir/Todo/global_len.fir
deleted file mode 100644
index 0f4bb61ce1f72..0000000000000
--- a/flang/test/Fir/Todo/global_len.fir
+++ /dev/null
@@ -1,11 +0,0 @@
-// RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s
-
-// Test `fir.global_len` conversion to llvm.
-// Not implemented yet.
-
-fir.global @global_derived : !fir.type<minez(f:i32)> {
-// CHECK: not yet implemented fir.global_len codegen
-  fir.global_len f, 1 : i32
-  %0 = fir.undefined !fir.type<minez>
-  fir.has_value %0 : !fir.type<minez>
-}

diff  --git a/flang/test/Fir/Todo/len_param_index.fir b/flang/test/Fir/Todo/len_param_index.fir
deleted file mode 100644
index 4cef659ef2979..0000000000000
--- a/flang/test/Fir/Todo/len_param_index.fir
+++ /dev/null
@@ -1,11 +0,0 @@
-// RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s
-
-// Test `fir.len_param_index` conversion to llvm.
-// Not implemented yet.
-
-func @lenparamindex() {
-  // CHECK: not yet implemented fir.len_param_index codegen
-  %0 = fir.len_param_index l1, !fir.type<twolens(l1:i32, l2:i32){i:i32, f:f32, l:i64}>
-  return
-}
-

diff  --git a/flang/test/Fir/Todo/select_case_with_character.fir b/flang/test/Fir/Todo/select_case_with_character.fir
deleted file mode 100644
index 823a65b1c59f2..0000000000000
--- a/flang/test/Fir/Todo/select_case_with_character.fir
+++ /dev/null
@@ -1,19 +0,0 @@
-// RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s
-
-// Test `fir.select_case` conversion to llvm with character type.
-// Not implemented yet.
-
-func @select_case_charachter(%arg0: !fir.char<2, 10>, %arg1: !fir.char<2, 10>, %arg2: !fir.char<2, 10>) {
-// CHECK: not yet implemented fir.select_case codegen with character type
-  fir.select_case %arg0 : !fir.char<2, 10> [#fir.point, %arg1, ^bb1,
-                                            #fir.point, %arg2, ^bb2,
-                                            unit, ^bb3]
-^bb1:
-  %c1_i32 = arith.constant 1 : i32
-  br ^bb3
-^bb2:
-  %c2_i32 = arith.constant 2 : i32
-  br ^bb3
-^bb3:
-  return
-}

diff  --git a/flang/test/Fir/Todo/unboxproc.fir b/flang/test/Fir/Todo/unboxproc.fir
deleted file mode 100644
index e272f4dab2087..0000000000000
--- a/flang/test/Fir/Todo/unboxproc.fir
+++ /dev/null
@@ -1,11 +0,0 @@
-// RUN: not fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s
-
-// Test `fir.unboxproc` conversion to llvm.
-// Not implemented yet.
-// Currently fails since coversion for boxproc type is not implemented.
-
-// CHECK: failed to legalize operation 'builtin.func'
-func @boxing_match(%bproc: !fir.boxproc<(i32) -> ()>) {
-  %ubproc:2 = fir.unboxproc %bproc : (!fir.boxproc<(i32) -> ()>) -> ((i32) -> (), !fir.ref<tuple<i32,f64>>)
-  return
-}

diff  --git a/flang/test/Fir/convert-to-llvm-invalid.fir b/flang/test/Fir/convert-to-llvm-invalid.fir
index 41ffe7e5e6ddd..248ca5eb4555f 100644
--- a/flang/test/Fir/convert-to-llvm-invalid.fir
+++ b/flang/test/Fir/convert-to-llvm-invalid.fir
@@ -13,6 +13,99 @@ func @zero_aggregate() {
 
 // -----
 
+// Test that `fir.dispatch` fails to be legalized. Not implemented yet.
+
+func @dispatch(%arg0: !fir.box<!fir.type<derived3{f:f32}>>) {
+  // expected-error at +1{{failed to legalize operation 'fir.dispatch'}}
+  %0 = fir.dispatch "method"(%arg0) : (!fir.box<!fir.type<derived3{f:f32}>>) -> i32
+  return
+}
+
+// -----
+
+// Test that `fir.dispatch_table`/`fir.dt_entry` fails to be legalized.
+// Not implemented yet.
+
+// expected-error at +1{{failed to legalize operation 'fir.dispatch_table'}}
+fir.dispatch_table @dispatch_tbl {
+  fir.dt_entry "method", @method_impl
+}
+
+// -----
+
+// Test `fir.select_case` conversion failure with character type.
+// Not implemented yet.
+
+func @select_case_charachter(%arg0: !fir.char<2, 10>, %arg1: !fir.char<2, 10>, %arg2: !fir.char<2, 10>) {
+  // expected-error at +1{{failed to legalize operation 'fir.select_case'}}
+  fir.select_case %arg0 : !fir.char<2, 10> [#fir.point, %arg1, ^bb1,
+                                            #fir.point, %arg2, ^bb2,
+                                            unit, ^bb3]
+^bb1:
+  %c1_i32 = arith.constant 1 : i32
+  br ^bb3
+^bb2:
+  %c2_i32 = arith.constant 2 : i32
+  br ^bb3
+^bb3:
+  return
+}
+
+// -----
+
+// Test `fir.select_type` conversion failure. Not implemented yet.
+
+func @bar_select_type(%arg : !fir.box<!fir.type<derived3{f:f32}>>) -> i32 {
+  %0 = arith.constant 1 : i32
+  %2 = arith.constant 3 : i32
+
+  // expected-error at +1{{failed to legalize operation 'fir.select_type'}}
+  fir.select_type %arg : !fir.box<!fir.type<derived3{f:f32}>> [
+    #fir.instance<!fir.int<4>>,^bb1(%0:i32),
+    #fir.instance<!fir.int<8>>,^bb2(%2:i32),
+    unit,^bb5 ]
+^bb1(%a : i32) :
+  return %a : i32
+^bb2(%b : i32) :
+  return %b : i32
+^bb5 :
+  %zero = arith.constant 0 : i32
+  return %zero : i32
+}
+
+// -----
+
+// Test `fir.global_len` conversion failure. Not implemented yet.
+
+fir.global @global_derived : !fir.type<minez(f:i32)> {
+  // expected-error at +1{{failed to legalize operation 'fir.global_len'}}
+  fir.global_len f, 1 : i32
+  %0 = fir.undefined !fir.type<minez>
+  fir.has_value %0 : !fir.type<minez>
+}
+
+// -----
+
+// 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() {
+  // expected-error at +1{{failed to legalize operation 'fir.gentypedesc'}}
+  %0 = fir.gentypedesc !fir.type<derived3>
+  return
+}
+
+// -----
+
 // Verify that `fir.dt_entry` requires a parent op
 
 // expected-error at +1{{'fir.dt_entry' op expects parent op 'fir.dispatch_table'}}
@@ -68,23 +161,32 @@ func @shape_shift_not_dead(%arg0: !fir.ref<!fir.array<?x?xf32>>, %i: index, %j:
 
 // -----
 
-// Test `fir.select_type` conversion to llvm.
-// Should have been converted.
+// Test that the type `fir.boxproc` fails to be legalized.
+// Not implemented yet.
 
-func @bar_select_type(%arg : !fir.box<!fir.ref<f32>>) -> i32 {
-  %0 = arith.constant 1 : i32
-  %2 = arith.constant 3 : i32
-  // expected-error at +2{{fir.select_type should have already been converted}}
-  // expected-error at +1{{failed to legalize operation 'fir.select_type'}}
-  fir.select_type %arg : !fir.box<!fir.ref<f32>> [
-    #fir.instance<!fir.int<4>>,^bb1(%0:i32),
-    #fir.instance<!fir.int<8>>,^bb2(%2:i32),
-    unit,^bb5 ]
-^bb1(%a : i32) :
-  return %a : i32
-^bb2(%b : i32) :
-  return %b : i32
-^bb5 :
-  %zero = arith.constant 0 : i32
-  return %zero : i32
+// expected-error at +1{{failed to legalize operation 'builtin.func'}}
+func private @foo0(%arg0: !fir.boxproc<() -> ()>)
+
+// -----
+
+// Test that `fir.emboxproc` fails to be legalized.
+// Not implemented yet.
+
+func private @method_impl(i32)
+
+func @emboxproc_test() {
+  %host_vars = fir.alloca tuple<i32,f64>
+// expected-error at +1{{failed to legalize operation 'fir.emboxproc'}}
+  %bproc = fir.emboxproc @method_impl, %host_vars : ((i32) -> (), !fir.ref<tuple<i32,f64>>) -> !fir.boxproc<(i32) -> ()>
+  return
 }
+
+// Test that `fir.unboxproc` and `fir.boxproc_host` also fails to be legalized.
+// At the moment these cannot be tested since the `fir.boxproc` type does not have a conversion.
+
+// -----
+
+// Test `fir.end` conversion failure. Not implemented yet.
+
+// expected-error at +1{{failed to legalize operation 'fir.end'}}
+"fir.end"() : () -> ()

diff  --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py
index 5f12298e9b9ab..130f74501b25e 100644
--- a/flang/test/lit.cfg.py
+++ b/flang/test/lit.cfg.py
@@ -35,10 +35,6 @@
 
 llvm_config.use_default_substitutions()
 
-# ask llvm-config about asserts
-llvm_config.feature_config(
-    [('--assertion-mode', {'ON': 'asserts'})])
-
 # excludes: A list of directories to exclude from the testsuite. The 'Inputs'
 # subdirectories contain auxiliary inputs for various tests in their parent
 # directories.
@@ -76,15 +72,6 @@
     ToolSubst('%flang_fc1', command=FindTool('flang-new'), extra_args=['-fc1'],
         unresolved='fatal')]
 
-# Flang has several unimplemented features. TODO messages are used to mark and fail if these
-# features are exercised. TODOs exit with an error in non-assert builds but in assert builds
-# it aborts. To catch aborts, the `--crash` option for the `not` command has to be used.
-if 'asserts' in config.available_features:
-    tools.append(ToolSubst('%not_todo_cmd', command=FindTool('not'), extra_args=['--crash'],
-        unresolved='fatal'))
-else:
-    tools.append(ToolSubst('%not_todo_cmd', command=FindTool('not'), unresolved='fatal'))
-
 # Define some variables to help us test that the flang runtime doesn't depend on
 # the C++ runtime libraries. For this we need a C compiler. If for some reason
 # we don't have one, we can just disable the test.


        


More information about the flang-commits mailing list