[Mlir-commits] [mlir] [mlir][Vector] Remove trivial uses of vector.extractelement/vector.insertelement (1/N) (PR #116053)

Jakub Kuderski llvmlistbot at llvm.org
Wed Nov 13 06:45:58 PST 2024


================
@@ -21,23 +21,13 @@ using namespace mlir::vector;
 // Helper that picks the proper sequence for inserting.
 static Value insertOne(PatternRewriter &rewriter, Location loc, Value from,
                        Value into, int64_t offset) {
-  auto vectorType = cast<VectorType>(into.getType());
-  if (vectorType.getRank() > 1)
-    return rewriter.create<InsertOp>(loc, from, into, offset);
-  return rewriter.create<vector::InsertElementOp>(
-      loc, vectorType, from, into,
-      rewriter.create<arith::ConstantIndexOp>(loc, offset));
+  return rewriter.create<InsertOp>(loc, from, into, offset);
----------------
kuhar wrote:

After simplifying, do these helper make sense or should we just inline them?

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


More information about the Mlir-commits mailing list