[Mlir-commits] [mlir] [MLIR][X86] Fix direct use.set() bypassing rewriter in rewriteUses (PR #188945)

Mehdi Amini llvmlistbot at llvm.org
Fri Mar 27 03:16:26 PDT 2026


https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/188945

rewriteUses was calling use.set(newVal) directly on OpOperand references, 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 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 b6ed5535f10b1fe6a4754ad1efbc1403338c67f1 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Thu, 26 Mar 2026 15:57:56 -0700
Subject: [PATCH] [MLIR][X86] Fix direct use.set() bypassing rewriter in
 rewriteUses

rewriteUses was calling use.set(newVal) directly on OpOperand references,
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 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.
---
 .../X86/Transforms/VectorContractToPackedTypeDotProduct.cpp    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/X86/Transforms/VectorContractToPackedTypeDotProduct.cpp b/mlir/lib/Dialect/X86/Transforms/VectorContractToPackedTypeDotProduct.cpp
index cdf0c3925d6a3..a4496f3620b97 100644
--- a/mlir/lib/Dialect/X86/Transforms/VectorContractToPackedTypeDotProduct.cpp
+++ b/mlir/lib/Dialect/X86/Transforms/VectorContractToPackedTypeDotProduct.cpp
@@ -49,11 +49,10 @@ static void rewriteUses(mlir::Value oldVal, mlir::Value newVal,
                         mlir::Operation *targetContract,
                         mlir::PatternRewriter &rewriter) {
   for (mlir::OpOperand &use : llvm::make_early_inc_range(oldVal.getUses())) {
-
     mlir::Operation *user = use.getOwner();
     if (mlir::isa<mlir::vector::ContractionOp>(user) ||
         mlir::isa<mlir::scf::ForOp>(user)) {
-      use.set(newVal);
+      rewriter.modifyOpInPlace(user, [&]() { use.set(newVal); });
     }
   }
 }



More information about the Mlir-commits mailing list