[Mlir-commits] [mlir] 6b2b0da - [mlir][CSE] Fix double-counting of numCSE statistic (#189802)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Apr 1 02:10:26 PDT 2026


Author: lonely eagle
Date: 2026-04-01T17:10:20+08:00
New Revision: 6b2b0da40de1495ace2b100799a35711f7ad7b21

URL: https://github.com/llvm/llvm-project/commit/6b2b0da40de1495ace2b100799a35711f7ad7b21
DIFF: https://github.com/llvm/llvm-project/commit/6b2b0da40de1495ace2b100799a35711f7ad7b21.diff

LOG: [mlir][CSE] Fix double-counting of numCSE statistic (#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. This is part of the
https://github.com/llvm/llvm-project/pull/180556.

Added: 
    

Modified: 
    mlir/lib/Transforms/CSE.cpp

Removed: 
    


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