Skip to content

Commit aab4e43

Browse files
committed
RequirementMachine: The three RewriteSystem::simplify*() methods check flags independently
We used to skip a pass if any of the three flags were set, but we have to check them separately to ensure that all flags are independently set correctly.
1 parent 1068962 commit aab4e43

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

lib/AST/RequirementMachine/RewriteSystem.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,7 @@ void RewriteSystem::simplifyLeftHandSides() {
476476

477477
for (unsigned ruleID = 0, e = Rules.size(); ruleID < e; ++ruleID) {
478478
auto &rule = getRule(ruleID);
479-
if (rule.isLHSSimplified() ||
480-
rule.isRHSSimplified() ||
481-
rule.isSubstitutionSimplified())
479+
if (rule.isLHSSimplified())
482480
continue;
483481

484482
// First, see if the left hand side of this rule can be reduced using
@@ -494,9 +492,7 @@ void RewriteSystem::simplifyLeftHandSides() {
494492

495493
// Ignore other deleted rules.
496494
const auto &otherRule = getRule(*otherRuleID);
497-
if (otherRule.isLHSSimplified() ||
498-
otherRule.isRHSSimplified() ||
499-
otherRule.isSubstitutionSimplified())
495+
if (otherRule.isLHSSimplified())
500496
continue;
501497

502498
if (Debug.contains(DebugFlags::Completion)) {
@@ -523,9 +519,7 @@ void RewriteSystem::simplifyRightHandSides() {
523519

524520
for (unsigned ruleID = 0, e = Rules.size(); ruleID < e; ++ruleID) {
525521
auto &rule = getRule(ruleID);
526-
if (rule.isLHSSimplified() ||
527-
rule.isRHSSimplified() ||
528-
rule.isSubstitutionSimplified())
522+
if (rule.isRHSSimplified())
529523
continue;
530524

531525
// Now, try to reduce the right hand side.
@@ -577,9 +571,7 @@ void RewriteSystem::simplifyRightHandSides() {
577571
void RewriteSystem::simplifyLeftHandSideSubstitutions() {
578572
for (unsigned ruleID = 0, e = Rules.size(); ruleID < e; ++ruleID) {
579573
auto &rule = getRule(ruleID);
580-
if (rule.isLHSSimplified() ||
581-
rule.isRHSSimplified() ||
582-
rule.isSubstitutionSimplified())
574+
if (rule.isSubstitutionSimplified())
583575
continue;
584576

585577
auto lhs = rule.getLHS();

0 commit comments

Comments
 (0)