[Mlir-commits] [mlir] [MLIR][X86] Fix direct setOperand() bypassing rewriter in shuffleBeforeWriteLikeOp (PR #188946)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Mar 27 03:17:25 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Mehdi Amini (joker-eph)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/188946.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/X86/Utils/X86Utils.cpp (+5-3)
``````````diff
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();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/188946
More information about the Mlir-commits
mailing list