[Mlir-commits] [mlir] [MLIR] Add `InParallelOpInterface` for parallel combining operations (PR #157736)

Alan Li llvmlistbot at llvm.org
Wed Sep 10 10:28:49 PDT 2025


================
@@ -1673,7 +1674,12 @@ struct ForallOpIterArgsFolder : public OpRewritePattern<ForallOp> {
     for (OpResult result : forallOp.getResults()) {
       OpOperand *opOperand = forallOp.getTiedOpOperand(result);
       BlockArgument blockArg = forallOp.getTiedBlockArgument(opOperand);
-      if (result.use_empty() || forallOp.getCombiningOps(blockArg).empty()) {
+      SmallVector<Operation *> combiningOps =
+          forallOp.getCombiningOps(blockArg);
+      if ((result.use_empty() &&
+           llvm::all_of(combiningOps,
+                        [](Operation *op) { return op->use_empty(); })) ||
+          combiningOps.empty()) {
----------------
lialan wrote:

Actually such change is not correct when combiningOps is empty.

The test to test it is [here](https://github.com/llvm/llvm-project/blob/main/mlir/test/Dialect/SCF/canonicalize.mlir#L1828).

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


More information about the Mlir-commits mailing list