[Mlir-commits] [mlir] 9ec5227 - [mlir][linalg] FuseIntoContainingOp: Always set newContainingOp

Matthias Springer llvmlistbot at llvm.org
Tue May 30 06:21:26 PDT 2023


Author: Matthias Springer
Date: 2023-05-30T15:14:36+02:00
New Revision: 9ec52275acd6120db9a33d4f97d28848166cf839

URL: https://github.com/llvm/llvm-project/commit/9ec52275acd6120db9a33d4f97d28848166cf839
DIFF: https://github.com/llvm/llvm-project/commit/9ec52275acd6120db9a33d4f97d28848166cf839.diff

LOG: [mlir][linalg] FuseIntoContainingOp: Always set newContainingOp

All result handles must be set in case of success.

Differential Revision: https://reviews.llvm.org/D151705

Added: 
    

Modified: 
    mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index f18f24d4c3d9c..9233ce9b89bfb 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -699,11 +699,6 @@ transform::FuseIntoContainingOp::apply(transform::TransformResults &results,
                                        transform::TransformState &state) {
   SmallVector<Operation *> fusedOps;
   auto producerOps = state.getPayloadOps(getProducerOp());
-  // If nothing to fuse, propagate success.
-  if (std::empty(producerOps)) {
-    results.set(cast<OpResult>(getFusedOp()), SmallVector<mlir::Operation *>{});
-    return DiagnosedSilenceableFailure::success();
-  }
   auto containingOps = state.getPayloadOps(getContainingOp());
   if (!llvm::hasSingleElement(containingOps)) {
     return emitDefiniteFailure()
@@ -712,6 +707,13 @@ transform::FuseIntoContainingOp::apply(transform::TransformResults &results,
   }
   Operation *containingOp = *containingOps.begin();
 
+  // If nothing to fuse, propagate success.
+  if (std::empty(producerOps)) {
+    results.set(cast<OpResult>(getFusedOp()), SmallVector<mlir::Operation *>{});
+    results.set(cast<OpResult>(getNewContainingOp()), {containingOp});
+    return DiagnosedSilenceableFailure::success();
+  }
+
   // Helper function to find the next producer that should be fused. Take any
   // producer that has a use inside the containing op.
   SetVector<Operation *> remainingProducers(producerOps.begin(),


        


More information about the Mlir-commits mailing list