[Mlir-commits] [mlir] [mlir][Transforms] Improve `replaceOpWithMultiple` API (PR #132608)

Benjamin Maxwell llvmlistbot at llvm.org
Tue Mar 25 12:15:41 PDT 2025


================
@@ -192,7 +192,7 @@ struct LegalizeArithConstantOpsByDecomposition
     auto tileCount = getNumberOfSMETilesForVectorType(vectorType);
     auto tileSplat = rewriter.create<arith::ConstantOp>(
         constantOp.getLoc(), denseAttr.resizeSplat(smeTileType));
-    SmallVector<Value> repl(tileCount, tileSplat);
+    SmallVector<Value, 1> repl(tileCount, tileSplat);
----------------
MacDue wrote:

> The reason why I use SmallVector<Value, 1> here is so that we can avoid copying the vector. 

Which copy is this avoiding? Won't there always be a copy into the internal data structure in the end anyway? Since `ArrayRef<SmallVector<Value, 1>>` since `ArrayRef`s are constant, so you can't `std::move()` the vector out of the ArrayRef.

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


More information about the Mlir-commits mailing list