[Mlir-commits] [mlir] [MLIR][MPI] Fix direct getRefMutable().assign() bypassing rewriter in FoldCast (PR #188943)
Mehdi Amini
llvmlistbot at llvm.org
Fri Mar 27 03:06:47 PDT 2026
https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/188943
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.
>From 2733c3eb1d18dcaa85ecc06f1f873092e56f54d3 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Thu, 26 Mar 2026 15:57:57 -0700
Subject: [PATCH] [MLIR][MPI] Fix direct getRefMutable().assign() bypassing
rewriter in FoldCast
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.
---
mlir/lib/Dialect/MPI/IR/MPIOps.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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();
}
};
More information about the Mlir-commits
mailing list