mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CS] Remove ConstraintGraph::removeEdge
The only caller was `contractEdges`, which would only call it with constraints from either the active or inactive list. The implementation can therefore be replaced by `ConstraintSystem::retireConstraint`, and `removeGeneratedConstraint` can also be removed.
This commit is contained in:
@@ -1165,8 +1165,8 @@ bool ConstraintGraph::contractEdges() {
|
||||
log << "\n";
|
||||
}
|
||||
|
||||
// Merge the edges and remove the constraint.
|
||||
removeEdge(constraint);
|
||||
// Merge the edges and retire the constraint.
|
||||
CS.retireConstraint(constraint);
|
||||
if (rep1 != rep2)
|
||||
CS.mergeEquivalenceClasses(rep1, rep2, /*updateWorkList*/ false);
|
||||
didContractEdges = true;
|
||||
@@ -1175,35 +1175,6 @@ bool ConstraintGraph::contractEdges() {
|
||||
return didContractEdges;
|
||||
}
|
||||
|
||||
void ConstraintGraph::removeEdge(Constraint *constraint) {
|
||||
bool isExistingConstraint = false;
|
||||
|
||||
for (auto &active : CS.ActiveConstraints) {
|
||||
if (&active == constraint) {
|
||||
CS.ActiveConstraints.erase(constraint);
|
||||
isExistingConstraint = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &inactive : CS.InactiveConstraints) {
|
||||
if (&inactive == constraint) {
|
||||
CS.InactiveConstraints.erase(constraint);
|
||||
isExistingConstraint = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (CS.solverState) {
|
||||
if (isExistingConstraint)
|
||||
CS.solverState->retireConstraint(constraint);
|
||||
else
|
||||
CS.solverState->removeGeneratedConstraint(constraint);
|
||||
}
|
||||
|
||||
removeConstraint(constraint);
|
||||
}
|
||||
|
||||
void ConstraintGraph::optimize() {
|
||||
// Merge equivalence classes until a fixed point is reached.
|
||||
while (contractEdges()) {}
|
||||
|
||||
Reference in New Issue
Block a user