[mlir][linalg] Tune getTiedIndexingMap method (NFC).
authorTobias Gysi <gysit@google.com>
Wed, 25 Aug 2021 18:43:41 +0000 (18:43 +0000)
committerTobias Gysi <gysit@google.com>
Wed, 25 Aug 2021 18:44:01 +0000 (18:44 +0000)
Optimize the performance by using the range directly.

Reviewed By: benvanik

Differential Revision: https://reviews.llvm.org/D108715

mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td

index 5f90045..a276e7b 100644 (file)
@@ -589,7 +589,9 @@ def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
       /*methodBody=*/"",
       /*defaultImplementation=*/[{
         assert(opOperand->getOwner() == this->getOperation());
-        return getIndexingMaps()[opOperand->getOperandNumber()];
+        auto indexingMaps =
+          $_op.indexing_maps().template getAsValueRange<AffineMapAttr>();
+        return *(indexingMaps.begin() + opOperand->getOperandNumber());
       }]
     >,
     InterfaceMethod<