[Mlir-commits] [mlir] [mlir][memref] Use array notation instead of permutation map for memref.transpose (PR #67880)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Sep 30 15:25:40 PDT 2023


================
@@ -3259,6 +3267,15 @@ OpFoldResult TransposeOp::fold(FoldAdaptor) {
   return {};
 }
 
+bool TransposeOp::isIdentity() {
+  ArrayRef<int64_t> permutationArray = getPermutation();
+  for (int64_t i = 0, rank = permutationArray.size(); i < rank; ++i)
----------------
MaheshRavishankar wrote:

Nit: the norm is to use iterator utils like this

```
for (auto [index, dim] : llvm::enumerate(getPermutation()))
  if (index != dim)
    return false;
return true;
```



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


More information about the Mlir-commits mailing list