[Mlir-commits] [mlir] [MLIR] Add `InParallelOpInterface` for parallel combining operations (PR #157736)
Mehdi Amini
llvmlistbot at llvm.org
Tue Sep 9 12:51:38 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()) {
----------------
joker-eph wrote:
```suggestion
if ((result.use_empty() &&
llvm::all_of(forallOp.getCombiningOps(blockArg),
[](Operation *op) { return op->use_empty(); }))) {
```
The `empty()` check is redundant: `all_of` returns `true` on empty ranges.
Also which test is covering this change?
https://github.com/llvm/llvm-project/pull/157736
More information about the Mlir-commits
mailing list