[llvm] 77da125 - [Matrix] Collect split/reshape stats, even without -debug-only=

Jon Roelofs via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 12:32:35 PDT 2025


Author: Jon Roelofs
Date: 2025-06-10T12:31:35-07:00
New Revision: 77da1257b61c728a4d35dc518bfb758d0b1ddf26

URL: https://github.com/llvm/llvm-project/commit/77da1257b61c728a4d35dc518bfb758d0b1ddf26
DIFF: https://github.com/llvm/llvm-project/commit/77da1257b61c728a4d35dc518bfb758d0b1ddf26.diff

LOG: [Matrix] Collect split/reshape stats, even without -debug-only=

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
index 026f2fa96146a..21683089a4693 100644
--- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
@@ -57,10 +57,8 @@ using namespace PatternMatch;
 #define DEBUG_TYPE "lower-matrix-intrinsics"
 
 STATISTIC(FlattenedMatrices, "Number of matrix flattenings");
-#ifndef NDEBUG
 STATISTIC(ReshapedMatrices, "Number of matrix reshapes");
 STATISTIC(SplitMatrices, "Number of matrix splits");
-#endif
 
 static cl::opt<bool>
     FuseMatrix("fuse-matrix", cl::init(true), cl::Hidden,
@@ -627,27 +625,29 @@ class LowerMatrixIntrinsics {
       SplitVecs.push_back(V);
     }
 
-    LLVM_DEBUG(if (Instruction *Inst = dyn_cast<Instruction>(MatrixVal)) {
+    if (Instruction *Inst = dyn_cast<Instruction>(MatrixVal)) {
       if (Found != Inst2ColumnMatrix.end()) {
         // FIXME: re: "at least": SplitVecs.size() doesn't count the shuffles
         // that embedInVector created.
-        dbgs() << "matrix reshape from " << Found->second.shape() << " to "
-               << SI << " using at least " << SplitVecs.size()
-               << " shuffles on behalf of:\n"
-               << *Inst << '\n';
+        LLVM_DEBUG(dbgs() << "matrix reshape from " << Found->second.shape()
+                          << " to " << SI << " using at least "
+                          << SplitVecs.size() << " shuffles on behalf of:\n"
+                          << *Inst << '\n');
         ReshapedMatrices++;
       } else if (!ShapeMap.contains(MatrixVal)) {
-        dbgs() << "splitting a " << SI << " matrix with " << SplitVecs.size()
-               << " shuffles beacuse we do not have a shape-aware lowering for "
-                  "its def:\n"
-               << *Inst << '\n';
+        LLVM_DEBUG(
+            dbgs()
+            << "splitting a " << SI << " matrix with " << SplitVecs.size()
+            << " shuffles beacuse we do not have a shape-aware lowering for "
+               "its def:\n"
+            << *Inst << '\n');
         SplitMatrices++;
       } else {
         // The ShapeMap has it, so it's a case where we're being lowered
         // before the def, and we expect that InstCombine will clean things up
         // afterward.
       }
-    });
+    }
 
     return {SplitVecs};
   }


        


More information about the llvm-commits mailing list