Skip to content

RequirementMachine: New minimal conformances algorithm #59861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions lib/AST/RequirementMachine/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,33 @@ enum class DebugFlags : unsigned {
/// Print debug output from the minimal conformances algorithm.
MinimalConformances = (1<<9),

/// Print more detailed debug output from the minimal conformances algorithm.
MinimalConformancesDetail = (1<<10),

/// Print debug output from the protocol dependency graph.
ProtocolDependencies = (1<<10),
ProtocolDependencies = (1<<11),

/// Print debug output from generic signature minimization.
Minimization = (1<<11),
Minimization = (1<<12),

/// Print redundant rules and their replacement paths.
RedundantRules = (1<<12),
RedundantRules = (1<<13),

/// Print more detail about redundant rules.
RedundantRulesDetail = (1<<13),
RedundantRulesDetail = (1<<14),

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

/// Print debug output from propagating explicit requirement
/// IDs from redundant rules.
PropagateRequirementIDs = (1<<15),
PropagateRequirementIDs = (1<<16),

/// Print a trace of requirement machines constructed and how long each took.
Timers = (1<<16),
Timers = (1<<17),

/// Print conflicting rules.
ConflictingRules = (1<<17),
ConflictingRules = (1<<18),
};

using DebugOptions = OptionSet<DebugFlags>;
Expand Down
5 changes: 3 additions & 2 deletions lib/AST/RequirementMachine/HomotopyReduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include "PropertyMap.h"
#include "RewriteContext.h"
#include "RewriteSystem.h"

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

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