[Mlir-commits] [mlir] [mlir][CSE] Fix double-counting of numCSE statistic (PR #189802)
lonely eagle
llvmlistbot at llvm.org
Tue Mar 31 23:18:08 PDT 2026
https://github.com/linuxlonelyeagle created https://github.com/llvm/llvm-project/pull/189802
This PR fixes a regression where the numCSE statistic was being incremented twice for a single operation elimination. The numCSE counter is already internally incremented within the replaceUsesAndDelete function. Manually incrementing it again after the function call leads to an inaccurate total count.
>From 8dab1ba0310ddaeffdf5dd3dc3c0367e6c275f9c Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Wed, 1 Apr 2026 06:10:29 +0000
Subject: [PATCH] Remove the increment of numCSE after call
replaceUsesAndDelete.
---
mlir/lib/Transforms/CSE.cpp | 1 -
1 file changed, 1 deletion(-)
diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp
index 289cfb8408c37..b8f3999d45f59 100644
--- a/mlir/lib/Transforms/CSE.cpp
+++ b/mlir/lib/Transforms/CSE.cpp
@@ -298,7 +298,6 @@ LogicalResult CSEDriver::simplifyOperation(ScopedMapTy &knownValues,
// Look for an existing definition for the operation.
if (auto *existing = knownValues.lookup(op)) {
replaceUsesAndDelete(knownValues, op, existing, hasSSADominance);
- ++numCSE;
return success();
}
More information about the Mlir-commits
mailing list