[Mlir-commits] [mlir] [MLIR][X86] Fix direct setOperand() bypassing rewriter in shuffleBeforeWriteLikeOp (PR #188946)
Mehdi Amini
llvmlistbot at llvm.org
Fri Mar 27 03:16:45 PDT 2026
https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/188946
shuffleBeforeWriteLikeOp was calling opA->setOperand() and opB->setOperand() 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 both modifications with rewriter.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 7d29118fb928ddf1a877a5f40a739cb5523ef853 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Thu, 26 Mar 2026 15:57:54 -0700
Subject: [PATCH] [MLIR][X86] Fix direct setOperand() bypassing rewriter in
shuffleBeforeWriteLikeOp
shuffleBeforeWriteLikeOp was calling opA->setOperand() and
opB->setOperand() 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 both
modifications with rewriter.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/X86/Utils/X86Utils.cpp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mlir/lib/Dialect/X86/Utils/X86Utils.cpp b/mlir/lib/Dialect/X86/Utils/X86Utils.cpp
index 3893d8d288f32..f4279a3eb507a 100644
--- a/mlir/lib/Dialect/X86/Utils/X86Utils.cpp
+++ b/mlir/lib/Dialect/X86/Utils/X86Utils.cpp
@@ -324,9 +324,11 @@ LogicalResult shuffleBeforeWriteLikeOp(PatternRewriter &rewriter,
auto newVecA = vector::ShapeCastOp::create(rewriter, loc, accTy, shuffledLo);
auto newVecB = vector::ShapeCastOp::create(rewriter, loc, accTy, shuffledHi);
- // Update write operands in place
- opA->setOperand(0, newVecA.getResult());
- opB->setOperand(0, newVecB.getResult());
+ // Update write operands in place via the rewriter to notify it of changes.
+ rewriter.modifyOpInPlace(opA,
+ [&]() { opA->setOperand(0, newVecA.getResult()); });
+ rewriter.modifyOpInPlace(opB,
+ [&]() { opB->setOperand(0, newVecB.getResult()); });
return success();
}
More information about the Mlir-commits
mailing list