[Mlir-commits] [mlir] [mlir][Affine][NFC] Define AffineForOp operands in ODS (PR #67694)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Fri Sep 29 00:58:21 PDT 2023


================
@@ -283,19 +278,17 @@ def AffineForOp : Affine_Op<"for",
     AffineBound getUpperBound();
 
     /// Returns loop step.
-    int64_t getStep() {
-      return ::llvm::cast<IntegerAttr>(*(*this)->getInherentAttr(getStepAttrStrName())).getInt();
-    }
+    int64_t getStepAsInt() { return getStep().getSExtValue(); }
 
     /// Returns affine map for the lower bound.
     AffineMap getLowerBoundMap() { return getLowerBoundMapAttr().getValue(); }
     AffineMapAttr getLowerBoundMapAttr() {
-      return ::llvm::cast<AffineMapAttr>(*(*this)->getInherentAttr(getLowerBoundAttrStrName()));
+      return ::llvm::cast<AffineMapAttr>(getOperation()->getAttr(getLowerBoundAttrStrName()));
----------------
ftynse wrote:

I think we could also move the bound maps to listed attributes/properties.

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


More information about the Mlir-commits mailing list