[Mlir-commits] [mlir] 045f65e - [MLIR][X86] Fix direct setOperand() bypassing rewriter in shuffleBeforeWriteLikeOp (#188946)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Mar 27 04:03:38 PDT 2026


Author: Mehdi Amini
Date: 2026-03-27T12:03:34+01:00
New Revision: 045f65e9f822db1a2c3559bbeef32184e844c580

URL: https://github.com/llvm/llvm-project/commit/045f65e9f822db1a2c3559bbeef32184e844c580
DIFF: https://github.com/llvm/llvm-project/commit/045f65e9f822db1a2c3559bbeef32184e844c580.diff

LOG: [MLIR][X86] Fix direct setOperand() bypassing rewriter in shuffleBeforeWriteLikeOp (#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.

Added: 
    

Modified: 
    mlir/lib/Dialect/X86/Utils/X86Utils.cpp

Removed: 
    


################################################################################
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