Skip to content

Commit 506cc35

Browse files
committed
RequirementMachine: New minimal conformances algorithm
1 parent 93b94f9 commit 506cc35

File tree

6 files changed

+307
-31
lines changed

6 files changed

+307
-31
lines changed

lib/AST/RequirementMachine/Debug.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,30 +51,33 @@ enum class DebugFlags : unsigned {
5151
/// Print debug output from the minimal conformances algorithm.
5252
MinimalConformances = (1<<9),
5353

54+
/// Print more detailed debug output from the minimal conformances algorithm.
55+
MinimalConformancesDetail = (1<<10),
56+
5457
/// Print debug output from the protocol dependency graph.
55-
ProtocolDependencies = (1<<10),
58+
ProtocolDependencies = (1<<11),
5659

5760
/// Print debug output from generic signature minimization.
58-
Minimization = (1<<11),
61+
Minimization = (1<<12),
5962

6063
/// Print redundant rules and their replacement paths.
61-
RedundantRules = (1<<12),
64+
RedundantRules = (1<<13),
6265

6366
/// Print more detail about redundant rules.
64-
RedundantRulesDetail = (1<<13),
67+
RedundantRulesDetail = (1<<14),
6568

6669
/// Print debug output from the concrete contraction pre-processing pass.
67-
ConcreteContraction = (1<<14),
70+
ConcreteContraction = (1<<15),
6871

6972
/// Print debug output from propagating explicit requirement
7073
/// IDs from redundant rules.
71-
PropagateRequirementIDs = (1<<15),
74+
PropagateRequirementIDs = (1<<16),
7275

7376
/// Print a trace of requirement machines constructed and how long each took.
74-
Timers = (1<<16),
77+
Timers = (1<<17),
7578

7679
/// Print conflicting rules.
77-
ConflictingRules = (1<<17),
80+
ConflictingRules = (1<<18),
7881
};
7982

8083
using DebugOptions = OptionSet<DebugFlags>;

lib/AST/RequirementMachine/HomotopyReduction.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#include "llvm/Support/Debug.h"
6262
#include "llvm/Support/raw_ostream.h"
6363
#include <algorithm>
64+
#include "PropertyMap.h"
6465
#include "RewriteContext.h"
6566
#include "RewriteSystem.h"
6667

@@ -452,7 +453,7 @@ void RewriteSystem::performHomotopyReduction(
452453
/// is deleted.
453454
///
454455
/// Redundant rules are mutated to set their isRedundant() bit.
455-
void RewriteSystem::minimizeRewriteSystem() {
456+
void RewriteSystem::minimizeRewriteSystem(const PropertyMap &map) {
456457
if (Debug.contains(DebugFlags::HomotopyReduction)) {
457458
llvm::dbgs() << "-----------------------------\n";
458459
llvm::dbgs() << "- Minimizing rewrite system -\n";
@@ -538,7 +539,7 @@ void RewriteSystem::minimizeRewriteSystem() {
538539
// compute conformance access paths, instead of the current "brute force"
539540
// algorithm used for that purpose.
540541
llvm::DenseSet<unsigned> redundantConformances;
541-
computeMinimalConformances(redundantConformances);
542+
computeMinimalConformances(map, redundantConformances);
542543

543544
// Third pass: Eliminate all non-minimal conformance rules.
544545
if (Debug.contains(DebugFlags::HomotopyReduction)) {

0 commit comments

Comments
 (0)