[Mlir-commits] [mlir] [OpenMP][MLIR] Add omp.canonical_loop operation, !omp.cli type, omp.new_cli operation (PR #71712)

Kiran Chandramohan llvmlistbot at llvm.org
Tue Nov 14 23:48:16 PST 2023


================
@@ -1551,6 +1551,87 @@ LogicalResult DataBoundsOp::verify() {
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// CanonicaLoopOp
+//===----------------------------------------------------------------------===//
+
+Value mlir::omp::CanonicalLoopOp::getInductionVar() {
+  return getRegion().getArgument(0);
+}
+
+void mlir::omp::CanonicalLoopOp::print(OpAsmPrinter &p) {
+  p << " " << getInductionVar() << " : " << getInductionVar().getType()
+    << " in [0, " << getTripCount() << ")";
+  if (getCli()) {
+    p << ", " << getCli() << " : " << getCli().getType();
+  }
+  p << " ";
+
+  // omp.yield is implicit if no arguments passed to it.
+  p.printRegion(getRegion(), /*printEntryBlockArgs=*/false,
+                /*printBlockTerminators=*/true);
+
+  p.printOptionalAttrDict((*this)->getAttrs());
+}
+
+mlir::ParseResult
+mlir::omp::CanonicalLoopOp::parse(::mlir::OpAsmParser &parser,
+                                  ::mlir::OperationState &result) {
+  Builder &builder = parser.getBuilder();
+
+  // We derive the type of tripCount from inductionVariable. Unfortunatelty we
----------------
kiranchandramohan wrote:

```suggestion
  // We derive the type of tripCount from inductionVariable. Unfortunately we
```

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


More information about the Mlir-commits mailing list