[Mlir-commits] [mlir] 459ad97 - [mlir][vector] Reapply remaining cleanups from D139022. NFC.

Jakub Kuderski llvmlistbot at llvm.org
Wed Nov 30 15:55:07 PST 2022


Author: Jakub Kuderski
Date: 2022-11-30T18:52:54-05:00
New Revision: 459ad97221fcdfa41d647a11b0ff02b5133e27c6

URL: https://github.com/llvm/llvm-project/commit/459ad97221fcdfa41d647a11b0ff02b5133e27c6
DIFF: https://github.com/llvm/llvm-project/commit/459ad97221fcdfa41d647a11b0ff02b5133e27c6.diff

LOG: [mlir][vector] Reapply remaining cleanups from D139022. NFC.

It appears that structured bindings in function templates require extra
`template` keyword sparkled before `.cast<T>()` calls.

Added: 
    

Modified: 
    mlir/lib/Dialect/Vector/IR/VectorOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
index 7bbb120f78f1..f417afc49066 100644
--- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
@@ -2384,17 +2384,17 @@ static LogicalResult
 isIntegerArrayAttrConfinedToShape(OpType op, ArrayAttr arrayAttr,
                                   ArrayRef<int64_t> shape, StringRef attrName,
                                   bool halfOpen = true, int64_t min = 0) {
-  unsigned index = 0;
-  for (auto [attr, maxDim] : llvm::zip_first(arrayAttr, shape)) {
-    int64_t val = attr.template cast<IntegerAttr>().getInt();
-    int64_t max = maxDim;
+  for (auto [index, attrDimPair] :
+       llvm::enumerate(llvm::zip_first(arrayAttr, shape))) {
+    int64_t val =
+        std::get<0>(attrDimPair).template cast<IntegerAttr>().getInt();
+    int64_t max = std::get<1>(attrDimPair);
     if (!halfOpen)
       max += 1;
     if (val < min || val >= max)
       return op.emitOpError("expected ")
              << attrName << " dimension " << index << " to be confined to ["
              << min << ", " << max << ")";
-    ++index;
   }
   return success();
 }
@@ -2409,11 +2409,10 @@ static LogicalResult isSumOfIntegerArrayAttrConfinedToShape(
     bool halfOpen = true, int64_t min = 1) {
   assert(arrayAttr1.size() <= shape.size());
   assert(arrayAttr2.size() <= shape.size());
-  unsigned index = 0;
-  for (auto it :
-       llvm::zip(arrayAttr1, arrayAttr2, shape)) {
-    auto val1 = std::get<0>(it).cast<IntegerAttr>().getInt();
-    auto val2 = std::get<1>(it).cast<IntegerAttr>().getInt();
+  for (auto [index, it] :
+       llvm::enumerate(llvm::zip(arrayAttr1, arrayAttr2, shape))) {
+    auto val1 = std::get<0>(it).template cast<IntegerAttr>().getInt();
+    auto val2 = std::get<1>(it).template cast<IntegerAttr>().getInt();
     int64_t max = std::get<2>(it);
     if (!halfOpen)
       max += 1;
@@ -2421,8 +2420,6 @@ static LogicalResult isSumOfIntegerArrayAttrConfinedToShape(
       return op.emitOpError("expected sum(")
              << attrName1 << ", " << attrName2 << ") dimension " << index
              << " to be confined to [" << min << ", " << max << ")";
-
-    ++index;
   }
   return success();
 }


        


More information about the Mlir-commits mailing list