[Mlir-commits] [mlir] [mlir][Affine] Account for eliminated stores in fusion cost (PR #220711)

Uday Bondhugula llvmlistbot at llvm.org
Sat Sep 12 13:03:23 PDT 2026


================
@@ -154,6 +159,30 @@ static bool testLoopFusionUtilities(AffineForOp forOpA, AffineForOp forOpB,
   return false;
 }
 
+static LogicalResult testFusionComputeCost(AffineForOp srcForOp,
+                                           AffineForOp dstForOp) {
+  LoopNestStats srcStats;
+  LoopNestStats dstStats;
+  if (!getLoopNestStats(srcForOp, &srcStats) ||
+      !getLoopNestStats(dstForOp, &dstStats))
+    return failure();
+
+  ComputationSliceState slice;
+  slice.ivs.push_back(srcForOp.getInductionVar());
+  slice.lbs.resize(1);
+  slice.ubs.resize(1);
+  slice.lbOperands.resize(1);
+  slice.ubOperands.resize(1);
----------------
bondhugula wrote:

All these bounds have been left uninitialized. In fact, all this looks wrong. You'd have to make a call to mlir::affine::canFuseLoops to compute the slice.

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


More information about the Mlir-commits mailing list