Skip to content

Commit 5e54a52

Browse files
committed
RequirementMachine: Remove old implementation of simplifyLeftHandSideSubstitutions()
Now that the PropertyMap to the concrete simplification version is optional, we can just pass nullptr here to get the old behavior where type terms are simplified to canonical anchors and no concrete simplification is performed.
1 parent 2e3cb17 commit 5e54a52

File tree

3 files changed

+2
-43
lines changed

3 files changed

+2
-43
lines changed

lib/AST/RequirementMachine/KnuthBendix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ RewriteSystem::computeConfluentCompletion(unsigned maxRuleCount,
361361
resolvedLoops.clear();
362362

363363
simplifyRightHandSides();
364-
simplifyLeftHandSideSubstitutions();
364+
simplifyLeftHandSideSubstitutions(/*map=*/nullptr);
365365
} while (again);
366366

367367
return std::make_pair(CompletionResult::Success, 0);

lib/AST/RequirementMachine/RewriteSystem.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,6 @@ class RewriteSystem final {
339339

340340
void simplifyRightHandSides();
341341

342-
void simplifyLeftHandSideSubstitutions();
343-
344342
void simplifyLeftHandSideSubstitutions(const PropertyMap *map);
345343

346344
enum ValidityPolicy {

lib/AST/RequirementMachine/SimplifySubstitutions.cpp

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -91,43 +91,6 @@ bool RewriteSystem::simplifySubstitutions(Symbol &symbol,
9191
return true;
9292
}
9393

94-
/// Simplify substitution terms in superclass, concrete type and concrete
95-
/// conformance symbols.
96-
void RewriteSystem::simplifyLeftHandSideSubstitutions() {
97-
for (unsigned ruleID = 0, e = Rules.size(); ruleID < e; ++ruleID) {
98-
auto &rule = getRule(ruleID);
99-
if (rule.isSubstitutionSimplified())
100-
continue;
101-
102-
auto lhs = rule.getLHS();
103-
auto symbol = lhs.back();
104-
if (!symbol.hasSubstitutions())
105-
continue;
106-
107-
RewritePath path;
108-
109-
// (1) First, apply the original rule to produce the original lhs.
110-
path.add(RewriteStep::forRewriteRule(/*startOffset=*/0, /*endOffset=*/0,
111-
ruleID, /*inverse=*/true));
112-
113-
// (2) Now, simplify the substitutions to get the new lhs.
114-
if (!simplifySubstitutions(symbol, &path))
115-
continue;
116-
117-
// We're either going to add a new rule or record an identity, so
118-
// mark the old rule as simplified.
119-
rule.markSubstitutionSimplified();
120-
121-
MutableTerm newLHS(lhs.begin(), lhs.end() - 1);
122-
newLHS.add(symbol);
123-
124-
// Invert the path to get a path from the new lhs to the old rhs.
125-
path.invert();
126-
127-
addRule(newLHS, MutableTerm(rule.getRHS()), &path);
128-
}
129-
}
130-
13194
/// Simplify terms appearing in the substitutions of the last symbol of \p term,
13295
/// which must be a superclass or concrete type symbol.
13396
///
@@ -245,9 +208,7 @@ RewriteSystem::simplifySubstitutions(Term baseTerm, Symbol symbol,
245208
void RewriteSystem::simplifyLeftHandSideSubstitutions(const PropertyMap *map) {
246209
for (unsigned ruleID = 0, e = Rules.size(); ruleID < e; ++ruleID) {
247210
auto &rule = getRule(ruleID);
248-
if (rule.isLHSSimplified() ||
249-
rule.isRHSSimplified() ||
250-
rule.isSubstitutionSimplified())
211+
if (rule.isSubstitutionSimplified())
251212
continue;
252213

253214
auto optSymbol = rule.isPropertyRule();

0 commit comments

Comments
 (0)