[Mlir-commits] [mlir] [mlir][CSE] Fix double-counting of numCSE statistic (PR #189802)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Mar 31 23:18:42 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: lonely eagle (linuxlonelyeagle)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/189802.diff
1 Files Affected:
- (modified) mlir/lib/Transforms/CSE.cpp (-1)
``````````diff
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();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/189802
More information about the Mlir-commits
mailing list