[Mlir-commits] [mlir] [mlir][vector]add extractInsertFoldConstantOp fold function and apply it to extractOp and insertOp. (PR #124399)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Feb 10 05:45:42 PST 2025


================
@@ -1989,6 +1989,45 @@ static Value foldScalarExtractFromFromElements(ExtractOp extractOp) {
   return fromElementsOp.getElements()[flatIndex];
 }
 
+// If the dynamic indices of `extractOp` or `insertOp` are result of
+// `constantOp`, then fold it.
+template <typename OpType, typename AdaptorType>
----------------
ftynse wrote:

```suggestion
/// If the dynamic indices of `extractOp` or `insertOp` are in fact constants,
/// then fold it.
template <typename OpType, typename AdaptorType>
```

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


More information about the Mlir-commits mailing list