[PATCH] D113674: [flang] Add missing `HasParent` to `fir_DTEntryOp`

Andrzej Warzynski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 06:55:51 PST 2021


awarzynski created this revision.
awarzynski added reviewers: clementval, kiranchandramohan.
Herald added a project: Flang.
awarzynski requested review of this revision.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D113674

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


Index: flang/test/Fir/convert-to-llvm-invalid.fir
===================================================================
--- flang/test/Fir/convert-to-llvm-invalid.fir
+++ flang/test/Fir/convert-to-llvm-invalid.fir
@@ -27,3 +27,10 @@
 fir.dispatch_table @dispatch_tbl {
   fir.dt_entry "method", @method_impl
 }
+
+// -----
+
+// 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
Index: flang/include/flang/Optimizer/Dialect/FIROps.td
===================================================================
--- flang/include/flang/Optimizer/Dialect/FIROps.td
+++ flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -2868,7 +2868,7 @@
   }];
 }
 
-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 = [{


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113674.386504.patch
Type: text/x-patch
Size: 953 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211111/b31f125e/attachment.bin>


More information about the llvm-commits mailing list