[Mlir-commits] [mlir] [mlir] [linalg] Add canonicalize pattern to swap transpose with broadcast (PR #97063)

Diego Caballero llvmlistbot at llvm.org
Thu Jul 4 10:45:25 PDT 2024


================
@@ -252,6 +252,32 @@ mlir::computePermutationVector(int64_t permSize, ArrayRef<int64_t> positions,
   return res;
 }
 
+SmallVector<int64_t>
+mlir::removePermutation(ArrayRef<int64_t> inputPerm,
+                        ArrayRef<int64_t> removePositions) {
+  assert(inputPerm.size() >= removePositions.size() &&
+         "expect inputPerm size large than position to remove");
+  SmallVector<int64_t> res;
+  for (unsigned inputIndex = 0; inputIndex < inputPerm.size(); inputIndex++) {
----------------
dcaballe wrote:

nit: use pre-increment

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


More information about the Mlir-commits mailing list