[Mlir-commits] [mlir] [mlir][linalg] Add folder for `linalg.index` (PR #136640)
Quinn Dawkins
llvmlistbot at llvm.org
Mon Apr 21 18:40:39 PDT 2025
================
@@ -2283,6 +2283,35 @@ LogicalResult IndexOp::verify() {
return success();
}
+OpFoldResult IndexOp::fold(FoldAdaptor adaptor) {
+ auto linalgOp = cast<LinalgOp>((*this)->getParentOp());
+ int64_t flatDimPos =
+ cast<AffineDimExpr>(linalgOp.getShapesToLoopsMap().getResult(getDim()))
----------------
qedawkins wrote:
Also if you're calling `getShapesToLoopsMap` anyway, `getStaticLoopBounds` is the safer and easier way to do this anyway and replaces all of the logic below with just checking the shape of the dim in question.
https://github.com/llvm/llvm-project/pull/136640
More information about the Mlir-commits
mailing list