46
46
//
47
47
// Also, for a conformance rule (V.[P] => V) to be redundant, a stronger
48
48
// condition is needed than appearing once in a loop and without context;
49
- // the rule must not be a _generating conformance_. The algorithm for computing
50
- // a minimal set of generating conformances is implemented in
51
- // GeneratingConformances.cpp.
49
+ // the rule must not be a _minimal conformance_. The algorithm for computing
50
+ // minimal conformances is implemented in MinimalConformances.cpp.
52
51
//
53
52
// ===----------------------------------------------------------------------===//
54
53
@@ -129,7 +128,7 @@ RewriteLoop::findRulesAppearingOnceInEmptyContext(
129
128
// / explicit bit to all other rules appearing in empty context within the same
130
129
// / loop.
131
130
// /
132
- // / When computing generating conformances we prefer to eliminate non-explicit
131
+ // / When computing minimal conformances we prefer to eliminate non-explicit
133
132
// / rules, as a heuristic to ensure that minimized conformance requirements
134
133
// / remain in the same protocol as originally written, in cases where they can
135
134
// / be moved between protocols.
@@ -359,17 +358,18 @@ isCandidateForDeletion(unsigned ruleID,
359
358
return true ;
360
359
361
360
// Protocol conformance rules are eliminated via a different
362
- // algorithm which computes "generating conformances".
361
+ // algorithm which computes "minimal conformances". This runs between
362
+ // two passes of homotopy reduction.
363
363
//
364
364
// The first pass skips protocol conformance rules.
365
365
//
366
366
// The second pass eliminates any protocol conformance rule which is
367
- // redundant according to both homotopy reduction and the generating
367
+ // redundant according to both homotopy reduction and the minimal
368
368
// conformances algorithm.
369
369
//
370
- // Later on, we verify that any conformance redundant via generating
370
+ // Later on, we verify that any conformance redundant via minimal
371
371
// conformances was also redundant via homotopy reduction. This
372
- // means that the set of generating conformances is always a superset
372
+ // means that the set of minimal conformances is always a superset
373
373
// (or equal to) of the set of minimal protocol conformance
374
374
// requirements that homotopy reduction alone would produce.
375
375
if (rule.isAnyConformanceRule ()) {
@@ -392,11 +392,11 @@ isCandidateForDeletion(unsigned ruleID,
392
392
// / 1) First, rules that are not conformance rules are deleted, with
393
393
// / \p redundantConformances equal to nullptr.
394
394
// /
395
- // / 2) Second, generating conformances are computed.
395
+ // / 2) Second, minimal conformances are computed.
396
396
// /
397
397
// / 3) Finally, redundant conformance rules are deleted, with
398
398
// / \p redundantConformances equal to the set of conformance rules that are
399
- // / not generating conformances.
399
+ // / not minimal conformances.
400
400
Optional<unsigned > RewriteSystem::
401
401
findRuleToDelete (const llvm::DenseSet<unsigned > *redundantConformances,
402
402
RewritePath &replacementPath) {
@@ -524,15 +524,15 @@ void RewriteSystem::minimizeRewriteSystem() {
524
524
// First pass: Eliminate all redundant rules that are not conformance rules.
525
525
performHomotopyReduction (/* redundantConformances=*/ nullptr );
526
526
527
- // Now find a minimal set of generating conformances.
527
+ // Now compute a set of minimal conformances.
528
528
//
529
529
// FIXME: For now this just produces a set of redundant conformances, but
530
- // it should actually output the canonical generating conformance equation
531
- // for each non-generating conformance. We can then use information to
530
+ // it should actually output the canonical minimal conformance equation
531
+ // for each non-minimal conformance. We can then use information to
532
532
// compute conformance access paths, instead of the current "brute force"
533
533
// algorithm used for that purpose.
534
534
llvm::DenseSet<unsigned > redundantConformances;
535
- computeGeneratingConformances (redundantConformances);
535
+ computeMinimalConformances (redundantConformances);
536
536
537
537
// Second pass: Eliminate all redundant conformance rules.
538
538
performHomotopyReduction (/* redundantConformances=*/ &redundantConformances);
0 commit comments