[Mlir-commits] [mlir] [MLIR][MPI] Fix direct getRefMutable().assign() bypassing rewriter in FoldCast (PR #188943)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Mar 27 03:07:20 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Mehdi Amini (joker-eph)
<details>
<summary>Changes</summary>
The FoldCast canonicalization pattern was calling op.getRefMutable().assign(src) directly, bypassing the rewriter. This violates the pattern API contract and causes fingerprint change failures when
MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS is enabled. Wrap the modification with b.modifyOpInPlace() to properly notify the rewriter of the changes.
Assisted-by: Claude Code
Fix a failure present with MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS=ON.
---
Full diff: https://github.com/llvm/llvm-project/pull/188943.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/MPI/IR/MPIOps.cpp (+1-1)
``````````diff
diff --git a/mlir/lib/Dialect/MPI/IR/MPIOps.cpp b/mlir/lib/Dialect/MPI/IR/MPIOps.cpp
index e5e09e28998ba..3c93029f0d37f 100644
--- a/mlir/lib/Dialect/MPI/IR/MPIOps.cpp
+++ b/mlir/lib/Dialect/MPI/IR/MPIOps.cpp
@@ -52,7 +52,7 @@ struct FoldCast final : public mlir::OpRewritePattern<OpT> {
if (!src.getType().hasStaticShape()) {
return mlir::failure();
}
- op.getRefMutable().assign(src);
+ b.modifyOpInPlace(op, [&]() { op.getRefMutable().assign(src); });
return mlir::success();
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/188943
More information about the Mlir-commits
mailing list