|
22 | 22 | #include "llvm/ADT/ScopeExit.h" |
23 | 23 | #include "llvm/ADT/SmallSet.h" |
24 | 24 | #include "llvm/ADT/SmallVector.h" |
| 25 | +#include "llvm/ADT/Statistic.h" |
25 | 26 | #include "llvm/Analysis/AliasAnalysis.h" |
26 | 27 | #include "llvm/Analysis/DomTreeUpdater.h" |
27 | 28 | #include "llvm/Analysis/LoopInfo.h" |
@@ -53,6 +54,10 @@ using namespace PatternMatch; |
53 | 54 |
|
54 | 55 | #define DEBUG_TYPE "lower-matrix-intrinsics" |
55 | 56 |
|
| 57 | +STATISTIC(FlattenedMatrices, "Number of matrix flattenings"); |
| 58 | +STATISTIC(ReshapedMatrices, "Number of matrix reshapes"); |
| 59 | +STATISTIC(SplitMatrices, "Number of matrix splits"); |
| 60 | + |
56 | 61 | static cl::opt<bool> |
57 | 62 | FuseMatrix("fuse-matrix", cl::init(true), cl::Hidden, |
58 | 63 | cl::desc("Enable/disable fusing matrix instructions.")); |
@@ -597,11 +602,13 @@ class LowerMatrixIntrinsics { |
597 | 602 | dbgs() << "matrix reshape from " << Found->second.shape() << " to " |
598 | 603 | << SI << " using at least " << SplitVecs.size() |
599 | 604 | << " shuffles on behalf of:\n" << *Inst << '\n'; |
| 605 | + ReshapedMatrices++; |
600 | 606 | } else if (!ShapeMap.contains(MatrixVal)) { |
601 | 607 | dbgs() << "splitting a " << SI << " matrix with " << SplitVecs.size() |
602 | 608 | << " shuffles beacuse we do not have a shape-aware lowering for " |
603 | 609 | "its def:\n" |
604 | 610 | << *Inst << '\n'; |
| 611 | + SplitMatrices++; |
605 | 612 | } else { |
606 | 613 | // The ShapeMap has it, so it's a case where we're being lowered |
607 | 614 | // before the def, and we expect that InstCombine will clean things up |
@@ -1428,6 +1435,7 @@ class LowerMatrixIntrinsics { |
1428 | 1435 | << "\nbecause we do not have a shape-aware lowering for its " |
1429 | 1436 | "user:\n" |
1430 | 1437 | << *User << '\n';); |
| 1438 | + FlattenedMatrices++; |
1431 | 1439 | } |
1432 | 1440 | U.set(Flattened); |
1433 | 1441 | } |
|
0 commit comments