[Mlir-commits] [mlir] [mlir][vector]add extractInsertFoldConstantOp fold function and apply it to extractOp and insertOp. (PR #124399)
Andrzej WarzyĆski
llvmlistbot at llvm.org
Mon Feb 3 09:20:11 PST 2025
================
@@ -1986,6 +1986,42 @@ static Value foldScalarExtractFromFromElements(ExtractOp extractOp) {
return fromElementsOp.getElements()[flatIndex];
}
+// If the dynamic operands of `extractOp` or `insertOp` is result of
+// `constantOp`, then fold it.
+template <typename OpType, typename AdaptorType>
+static Value extractInsertFoldConstantOp(OpType op, AdaptorType adaptor,
+ SmallVectorImpl<Value> &operands) {
+ auto staticPosition = op.getStaticPosition().vec();
----------------
banach-space wrote:
Please spell out `auto`. The return type is not obvious:
* https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable
https://github.com/llvm/llvm-project/pull/124399
More information about the Mlir-commits
mailing list