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

Kunwar Grover llvmlistbot at llvm.org
Sat Jan 25 08:22:42 PST 2025


================
@@ -1999,6 +2039,8 @@ OpFoldResult ExtractOp::fold(FoldAdaptor) {
     return val;
   if (auto val = foldScalarExtractFromFromElements(*this))
     return val;
+  SmallVector<Value> operands = {getVector()};
+  foldConstantOp(*this, operands);
   return OpFoldResult();
----------------
Groverkss wrote:

This looks wrong. Even if you change the operation, you are still returning nullptr which means the folding didn't happen. Maybe make foldConstantOp return LogicalResult and check that.

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


More information about the Mlir-commits mailing list