[Mlir-commits] [mlir] [mlir][linalg] Add folder for `linalg.index` (PR #136640)
Quinn Dawkins
llvmlistbot at llvm.org
Tue Apr 22 06:50:51 PDT 2025
================
@@ -2283,6 +2283,19 @@ LogicalResult IndexOp::verify() {
return success();
}
+OpFoldResult IndexOp::fold(FoldAdaptor adaptor) {
+ auto linalgOp = cast<LinalgOp>((*this)->getParentOp());
+
+ // Index of unit dims is always 0.
+ SmallVector<int64_t, 4> loopBounds = linalgOp.getStaticLoopRanges();
----------------
qedawkins wrote:
This is the type returned by `getStaticLoopRanges()`. Wouldn't using a different size result in an extra copy of the vector?
https://github.com/llvm/llvm-project/pull/136640
More information about the Mlir-commits
mailing list