File tree 2 files changed +6
-11
lines changed
2 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -2384,8 +2384,7 @@ class ConstraintSystem {
2384
2384
2385
2385
// / The set of remembered disjunction choices used to reach
2386
2386
// / the current constraint system.
2387
- std::vector<std::pair<ConstraintLocator*, unsigned >>
2388
- DisjunctionChoices;
2387
+ llvm::MapVector<ConstraintLocator *, unsigned > DisjunctionChoices;
2389
2388
2390
2389
// / A map from applied disjunction constraints to the corresponding
2391
2390
// / argument function type.
@@ -4903,7 +4902,10 @@ class ConstraintSystem {
4903
4902
// / Record a particular disjunction choice of
4904
4903
void recordDisjunctionChoice (ConstraintLocator *disjunctionLocator,
4905
4904
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 });
4907
4909
}
4908
4910
4909
4911
// / 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() {
127
127
128
128
// Remember all the disjunction choices we made.
129
129
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 );
137
130
solution.DisjunctionChoices .insert (choice);
138
131
}
139
132
@@ -240,7 +233,7 @@ void ConstraintSystem::applySolution(const Solution &solution) {
240
233
241
234
// Register the solution's disjunction choices.
242
235
for (auto &choice : solution.DisjunctionChoices ) {
243
- DisjunctionChoices.push_back (choice);
236
+ DisjunctionChoices.insert (choice);
244
237
}
245
238
246
239
// Remember all of the argument/parameter matching choices we made.
You can’t perform that action at this time.
0 commit comments