Skip to content

Commit 44bd3fe

Browse files
committed
[CS] Don't record a generated and retired constraint
Retired constraints get added back to the inactive list when a scope rolls back, and generated constraints then get removed. So adding a constraint as both is unnecessary. Also assert that `addNewFailingConstraint` doesn't get called with an active constraint.
1 parent 4108352 commit 44bd3fe

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10080,22 +10080,13 @@ void ConstraintSystem::simplifyDisjunctionChoice(Constraint *choice) {
1008010080
case ConstraintSystem::SolutionKind::Error:
1008110081
if (!failedConstraint)
1008210082
failedConstraint = choice;
10083-
if (solverState)
10084-
solverState->retireConstraint(choice);
1008510083
break;
1008610084

1008710085
case ConstraintSystem::SolutionKind::Solved:
10088-
if (solverState)
10089-
solverState->retireConstraint(choice);
1009010086
break;
1009110087

1009210088
case ConstraintSystem::SolutionKind::Unsolved:
10093-
InactiveConstraints.push_back(choice);
10094-
CG.addConstraint(choice);
10089+
addUnsolvedConstraint(choice);
1009510090
break;
1009610091
}
10097-
10098-
// Record this as a generated constraint.
10099-
if (solverState)
10100-
solverState->addGeneratedConstraint(choice);
1010110092
}

lib/Sema/ConstraintSystem.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2932,14 +2932,8 @@ class ConstraintSystem {
29322932
/// Add a new constraint that we know fails.
29332933
void addNewFailingConstraint(Constraint *constraint) {
29342934
assert(shouldAddNewFailingConstraint());
2935+
assert(!constraint->isActive());
29352936
failedConstraint = constraint;
2936-
failedConstraint->setActive(false);
2937-
2938-
// Record this as a newly-generated constraint.
2939-
if (solverState) {
2940-
solverState->addGeneratedConstraint(constraint);
2941-
solverState->retireConstraint(constraint);
2942-
}
29432937
}
29442938

29452939
/// Add a newly-generated constraint that is known not to be solvable

0 commit comments

Comments
 (0)