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

Mehdi Amini llvmlistbot at llvm.org
Tue Sep 22 03:46:03 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);
----------------
joker-eph wrote:

Replaced the manually constructed slice with the result of canFuseLoops at depth 1

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


More information about the Mlir-commits mailing list