File tree Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Expand file tree Collapse file tree 2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -2384,8 +2384,7 @@ class ConstraintSystem {
23842384
23852385 // / The set of remembered disjunction choices used to reach
23862386 // / the current constraint system.
2387- std::vector<std::pair<ConstraintLocator*, unsigned >>
2388- DisjunctionChoices;
2387+ llvm::MapVector<ConstraintLocator *, unsigned > DisjunctionChoices;
23892388
23902389 // / A map from applied disjunction constraints to the corresponding
23912390 // / argument function type.
@@ -4903,7 +4902,10 @@ class ConstraintSystem {
49034902 // / Record a particular disjunction choice of
49044903 void recordDisjunctionChoice (ConstraintLocator *disjunctionLocator,
49054904 unsigned index) {
4906- DisjunctionChoices.push_back ({disjunctionLocator, index});
4905+ // We shouldn't ever register disjunction choices multiple times.
4906+ assert (!DisjunctionChoices.count (disjunctionLocator) ||
4907+ DisjunctionChoices[disjunctionLocator] == index);
4908+ DisjunctionChoices.insert ({disjunctionLocator, index});
49074909 }
49084910
49094911 // / Filter the set of disjunction terms, keeping only those where the
Original file line number Diff line number Diff line change @@ -127,13 +127,6 @@ Solution ConstraintSystem::finalize() {
127127
128128 // Remember all the disjunction choices we made.
129129 for (auto &choice : DisjunctionChoices) {
130- // We shouldn't ever register disjunction choices multiple times,
131- // but saving and re-applying solutions can cause us to get
132- // multiple entries. We should use an optimized PartialSolution
133- // structure for that use case, which would optimize a lot of
134- // stuff here.
135- assert (!solution.DisjunctionChoices .count (choice.first ) ||
136- solution.DisjunctionChoices [choice.first ] == choice.second );
137130 solution.DisjunctionChoices .insert (choice);
138131 }
139132
@@ -240,7 +233,7 @@ void ConstraintSystem::applySolution(const Solution &solution) {
240233
241234 // Register the solution's disjunction choices.
242235 for (auto &choice : solution.DisjunctionChoices ) {
243- DisjunctionChoices.push_back (choice);
236+ DisjunctionChoices.insert (choice);
244237 }
245238
246239 // Remember all of the argument/parameter matching choices we made.
You can’t perform that action at this time.
0 commit comments