File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
lib/AST/RequirementMachine Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 6464#include " llvm/Support/Debug.h"
6565#include " llvm/Support/raw_ostream.h"
6666#include < algorithm>
67+ #include " RewriteContext.h"
6768#include " RewriteSystem.h"
6869
6970using namespace swift ;
@@ -681,8 +682,15 @@ void RewriteSystem::computeGeneratingConformances(
681682 }
682683 }
683684
685+ Context.ConformanceRulesHistogram .add (conformanceRules.size ());
686+
684687 computeCandidateConformancePaths (conformancePaths);
685688
689+ for (const auto &pair : conformancePaths) {
690+ if (pair.second .size () > 1 )
691+ Context.GeneratingConformancesHistogram .add (pair.second .size ());
692+ }
693+
686694 if (Debug.contains (DebugFlags::GeneratingConformances)) {
687695 llvm::dbgs () << " Initial set of equations:\n " ;
688696 for (const auto &pair : conformancePaths) {
Original file line number Diff line number Diff line change @@ -59,7 +59,9 @@ RewriteContext::RewriteContext(ASTContext &ctx)
5959 RuleTrieHistogram(16 , /* Start=*/ 1 ),
6060 RuleTrieRootHistogram(16 ),
6161 PropertyTrieHistogram(16 , /* Start=*/ 1 ),
62- PropertyTrieRootHistogram(16 ) {
62+ PropertyTrieRootHistogram(16 ),
63+ ConformanceRulesHistogram(16 ),
64+ GeneratingConformancesHistogram(8 , /* Start=*/ 2 ) {
6365 auto debugFlags = StringRef (ctx.LangOpts .DebugRequirementMachine );
6466 if (!debugFlags.empty ())
6567 Debug = parseDebugFlags (debugFlags);
@@ -683,6 +685,10 @@ RewriteContext::~RewriteContext() {
683685 PropertyTrieHistogram.dump (llvm::dbgs ());
684686 llvm::dbgs () << " \n * Property trie root fanout:\n " ;
685687 PropertyTrieRootHistogram.dump (llvm::dbgs ());
688+ llvm::dbgs () << " \n * Conformance rules:\n " ;
689+ ConformanceRulesHistogram.dump (llvm::dbgs ());
690+ llvm::dbgs () << " \n * Generating conformance equations:\n " ;
691+ GeneratingConformancesHistogram.dump (llvm::dbgs ());
686692 }
687693
688694 for (const auto &pair : Machines)
Original file line number Diff line number Diff line change @@ -130,6 +130,8 @@ class RewriteContext final {
130130 Histogram RuleTrieRootHistogram;
131131 Histogram PropertyTrieHistogram;
132132 Histogram PropertyTrieRootHistogram;
133+ Histogram ConformanceRulesHistogram;
134+ Histogram GeneratingConformancesHistogram;
133135
134136 explicit RewriteContext (ASTContext &ctx);
135137
You can’t perform that action at this time.
0 commit comments