[flang-commits] [flang] [mlir][Interfaces] `LoopLikeOpInterface`: Support ops with multiple regions (PR #66754)

Markus Böck via flang-commits flang-commits at lists.llvm.org
Tue Sep 19 04:30:59 PDT 2023


================
@@ -36,14 +36,14 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
       /*args=*/(ins "::mlir::Value ":$value),
       /*methodBody=*/"",
       /*defaultImplementation=*/[{
-        return value.getParentRegion()->isProperAncestor(&$_op.getLoopBody());
+        return !$_op->isAncestor(value.getParentRegion()->getParentOp());
       }]
     >,
     InterfaceMethod<[{
-        Returns the region that makes up the body of the loop and should be
+        Returns the regions that make up the body of the loop and should be
         inspected for loop-invariant operations.
       }],
-      /*retTy=*/"::mlir::Region &",
+      /*retTy=*/"::llvm::SmallVector<::mlir::Region *>",
       /*methodName=*/"getLoopBody"
----------------
zero9178 wrote:

Is it worth renaming this to `getLoopRegions` or similar now? I feel like "body" has somewhat of a consistent meaning in MLIR, so far referring to a possibly single block region of a structured op, while in the new signature it now as the more abstract meaning of "the regions that make up the loop".

https://github.com/llvm/llvm-project/pull/66754


More information about the flang-commits mailing list