Index: mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td =================================================================== --- mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td +++ mlir/include/mlir/Dialect/Affine/IR/AffineMemoryOpInterfaces.td @@ -148,7 +148,7 @@ ]; } -def MemRefDereferencingInterface : OpInterface<"MemRefDereferencingInterface"> { +def AffineMapAccessInterface : OpInterface<"AffineMapAccessInterface"> { let description = [{ Interface to query characteristics of MemRef Dereferencing ops. }]; Index: mlir/include/mlir/Dialect/Affine/IR/AffineOps.h =================================================================== --- mlir/include/mlir/Dialect/Affine/IR/AffineOps.h +++ mlir/include/mlir/Dialect/Affine/IR/AffineOps.h @@ -83,7 +83,7 @@ class AffineDmaStartOp : public Op { + AffineMapAccessInterface::Trait> { public: using Op::Op; @@ -273,7 +273,7 @@ class AffineDmaWaitOp : public Op { + AffineMapAccessInterface::Trait> { public: using Op::Op; Index: mlir/include/mlir/Dialect/Affine/IR/AffineOps.td =================================================================== --- mlir/include/mlir/Dialect/Affine/IR/AffineOps.td +++ mlir/include/mlir/Dialect/Affine/IR/AffineOps.td @@ -458,7 +458,7 @@ class AffineLoadOpBase traits = []> : Affine_Op, - DeclareOpInterfaceMethods, + DeclareOpInterfaceMethods, MemRefsNormalizable])> { let arguments = (ins Arg:$memref, @@ -700,7 +700,7 @@ } def AffinePrefetchOp : Affine_Op<"prefetch", - [DeclareOpInterfaceMethods]> { + [DeclareOpInterfaceMethods]> { let summary = "affine prefetch operation"; let description = [{ The "affine.prefetch" op prefetches data from a memref location described @@ -779,7 +779,7 @@ class AffineStoreOpBase traits = []> : Affine_Op, - DeclareOpInterfaceMethods, + DeclareOpInterfaceMethods, MemRefsNormalizable])> { code extraClassDeclarationBase = [{ /// Returns the operand index of the value to be stored. Index: mlir/lib/Transforms/Utils/Utils.cpp =================================================================== --- mlir/lib/Transforms/Utils/Utils.cpp +++ mlir/lib/Transforms/Utils/Utils.cpp @@ -72,7 +72,8 @@ OpBuilder builder(op); // The following checks if op is dereferencing memref and performs the access // index rewrites. - if (!isa(*op)) { + auto affMapAcc = dyn_cast(op); + if (!affMapAcc) { if (!allowNonDereferencingOps) // Failure: memref used in a non-dereferencing context (potentially // escapes); no replacement in these cases unless allowNonDereferencingOps @@ -83,8 +84,7 @@ } // Perform index rewrites for the dereferencing op and then replace the op NamedAttribute oldMapAttrPair = - dyn_cast(op).getAffineMapAttrForMemRef( - oldMemRef); + affMapAcc.getAffineMapAttrForMemRef(oldMemRef); AffineMap oldMap = oldMapAttrPair.second.cast().getValue(); unsigned oldMapNumInputs = oldMap.getNumInputs(); SmallVector oldMapOperands( @@ -258,7 +258,7 @@ // Check if the memref was used in a non-dereferencing context. It is fine // for the memref to be used in a non-dereferencing way outside of the // region where this replacement is happening. - if (!isa(*op)) { + if (!isa(*op)) { if (!allowNonDereferencingOps) return failure(); // Currently we support the following non-dereferencing ops to be a