[Mlir-commits] [mlir] [mlir][scf] Extend option to yield replacement for multiple results case (PR #93144)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Jun 19 23:02:33 PDT 2024


================
@@ -1072,14 +1137,21 @@ mlir::scf::tileConsumerAndFuseProducersUsingSCF(
       continue;
 
     if (yieldReplacement) {
+      // Reconstruct and yield all opResult of fusableProducerOp by default. The
+      // caller can specific which one to yield by designating optional argument
+      // named `yieldResultNumber` of `yieldReplacementForFusedProducer`.
+      Operation *fusableProducerOp = fusableProducer.getOwner();
       if (failed(yieldReplacementForFusedProducer(
               rewriter, candidateSliceOp, fusedResult.value(), loops))) {
         return rewriter.notifyMatchFailure(
-            fusableProducer.getOwner(), "failed to replacement value for this "
-                                        "oepration from within the tiled loop");
+            fusableProducerOp, "failed to replacement value for this "
+                               "operation from within the tiled loop");
+      }
+      for (const auto &result : fusableProducerOp->getResults()) {
----------------
MaheshRavishankar wrote:

Nit: this could probably be easier as 
```
for (auto [index, result]: llvm::enumerate(fusableProducerOp->getResults())) {
  origValueResultNumber[result] = loops.front()->getNumResults() - fusableProducerOp->getNumResults() + index;
}

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


More information about the Mlir-commits mailing list