@@ -2566,8 +2566,7 @@ class ConstraintSystem {
25662566 // /
25672567 // / \param constraint The newly generated constraint.
25682568 void addGeneratedConstraint (Constraint *constraint) {
2569- assert (constraint && " Null generated constraint?" );
2570- generatedConstraints.push_back (constraint);
2569+ Trail.recordChange (SolverTrail::Change::GeneratedConstraint (constraint));
25712570 }
25722571
25732572 // / Register given scope to be tracked by the current solver state,
@@ -2582,8 +2581,7 @@ class ConstraintSystem {
25822581
25832582 CS.incrementScopeCounter ();
25842583 auto scopeInfo =
2585- std::make_tuple (scope, retiredConstraints.begin (),
2586- generatedConstraints.size ());
2584+ std::make_tuple (scope, retiredConstraints.begin ());
25872585 scopes.push_back (scopeInfo);
25882586 }
25892587
@@ -2604,10 +2602,8 @@ class ConstraintSystem {
26042602 SolverScope *savedScope;
26052603 // The position of last retired constraint before given scope.
26062604 ConstraintList::iterator lastRetiredPos;
2607- // The original number of generated constraints before given scope.
2608- unsigned numGenerated;
26092605
2610- std::tie (savedScope, lastRetiredPos, numGenerated ) =
2606+ std::tie (savedScope, lastRetiredPos) =
26112607 scopes.pop_back_val ();
26122608
26132609 assert (savedScope == scope && " Scope rollback not in LIFO order!" );
@@ -2616,15 +2612,6 @@ class ConstraintSystem {
26162612 CS.InactiveConstraints .splice (CS.InactiveConstraints .end (),
26172613 retiredConstraints,
26182614 retiredConstraints.begin (), lastRetiredPos);
2619-
2620- // And remove all of the generated constraints.
2621- auto genStart = generatedConstraints.begin () + numGenerated,
2622- genEnd = generatedConstraints.end ();
2623- for (auto genI = genStart; genI != genEnd; ++genI) {
2624- CS.InactiveConstraints .erase (ConstraintList::iterator (*genI));
2625- }
2626-
2627- generatedConstraints.erase (genStart, genEnd);
26282615 }
26292616
26302617 // / Check whether constraint system is allowed to form solutions
@@ -2660,17 +2647,13 @@ class ConstraintSystem {
26602647 // / creating, it's used to re-activate them on destruction.
26612648 SmallVector<Constraint *, 4 > activeConstraints;
26622649
2663- // / The current set of generated constraints.
2664- SmallVector<Constraint *, 4 > generatedConstraints;
2665-
26662650 // / The collection which holds association between solver scope
26672651 // / and position of the last retired constraint and number of
26682652 // / constraints generated before registration of given scope,
26692653 // / this helps to rollback all of the constraints retired/generated
26702654 // / each of the registered scopes correct (LIFO) order.
26712655 llvm::SmallVector<
2672- std::tuple<SolverScope *, ConstraintList::iterator, unsigned >, 4 > scopes;
2673-
2656+ std::tuple<SolverScope *, ConstraintList::iterator>, 4 > scopes;
26742657
26752658 // / Depth of the solution stack.
26762659 unsigned depth = 0 ;
0 commit comments