[Mlir-commits] [mlir] 0318123 - [mlir][Transforms] GreedyPatternRewriteDriver: Fix `changed` parameter
Matthias Springer
llvmlistbot at llvm.org
Fri Jul 21 23:49:03 PDT 2023
Author: Matthias Springer
Date: 2023-07-22T08:31:24+02:00
New Revision: 0318123f67d1edb0fb6c05e5b508c8798146b10f
URL: https://github.com/llvm/llvm-project/commit/0318123f67d1edb0fb6c05e5b508c8798146b10f
DIFF: https://github.com/llvm/llvm-project/commit/0318123f67d1edb0fb6c05e5b508c8798146b10f.diff
LOG: [mlir][Transforms] GreedyPatternRewriteDriver: Fix `changed` parameter
`changed` was not updated correctly when it was already set to "true" before calling `applyPatternsAndFoldGreedily`.
Differential Revision: https://reviews.llvm.org/D155934
Added:
Modified:
mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h b/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
index aaf6f0a8951257..b93ffd96bee5fa 100644
--- a/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
+++ b/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h
@@ -115,15 +115,17 @@ applyPatternsAndFoldGreedily(Operation *op,
const FrozenRewritePatternSet &patterns,
GreedyRewriteConfig config = GreedyRewriteConfig(),
bool *changed = nullptr) {
+ bool anyRegionChanged = false;
bool failed = false;
for (Region ®ion : op->getRegions()) {
bool regionChanged;
failed |=
applyPatternsAndFoldGreedily(region, patterns, config, ®ionChanged)
.failed();
- if (changed)
- *changed |= regionChanged;
+ anyRegionChanged |= regionChanged;
}
+ if (changed)
+ *changed = anyRegionChanged;
return failure(failed);
}
More information about the Mlir-commits
mailing list