[flang-commits] [flang] 50acc6d - [flang][fir] Add missing `HasParent` in `fir_DTEntryOp`

Andrzej Warzynski via flang-commits flang-commits at lists.llvm.org
Tue Nov 16 07:41:34 PST 2021


Author: Andrzej Warzynski
Date: 2021-11-16T15:40:55Z
New Revision: 50acc6d0f7dd120a1de589d241423fe5bdf54add

URL: https://github.com/llvm/llvm-project/commit/50acc6d0f7dd120a1de589d241423fe5bdf54add
DIFF: https://github.com/llvm/llvm-project/commit/50acc6d0f7dd120a1de589d241423fe5bdf54add.diff

LOG: [flang][fir] Add missing `HasParent` in `fir_DTEntryOp`

Differential Revision: https://reviews.llvm.org/D113674

Added: 
    

Modified: 
    flang/include/flang/Optimizer/Dialect/FIROps.td
    flang/test/Fir/convert-to-llvm-invalid.fir

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td
index 2d4261ea49b5..031b244f9544 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -2870,7 +2870,7 @@ def fir_DispatchTableOp : fir_Op<"dispatch_table",
   }];
 }
 
-def fir_DTEntryOp : fir_Op<"dt_entry", []> {
+def fir_DTEntryOp : fir_Op<"dt_entry", [HasParent<"DispatchTableOp">]> {
   let summary = "map entry in a dispatch table";
 
   let description = [{

diff  --git a/flang/test/Fir/convert-to-llvm-invalid.fir b/flang/test/Fir/convert-to-llvm-invalid.fir
index 632293988ca3..6aeb20845108 100644
--- a/flang/test/Fir/convert-to-llvm-invalid.fir
+++ b/flang/test/Fir/convert-to-llvm-invalid.fir
@@ -93,3 +93,10 @@ func @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'}}
+fir.dt_entry "method", @method_impl


        


More information about the flang-commits mailing list