Skip to content

Commit 6a3aa75

Browse files
committed
[ConstraintSystem] Tweak -disable-constraint-solver-performance-hacks.
Allow a couple of the tests in shortCircuitDisjunctionAt() to run even when hacks are disabled. The first of these tests is imperfect since it assumes that "favored" disjunction choices all come before the others (which may be the case now but is pretty brittle). Similarly, the second of these tests assumes that choices that are fixes always come after ones that are not. What we really want to do is skip these choices rather than stopping at these points.
1 parent 01c4c3c commit 6a3aa75

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/Sema/CSStep.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,6 @@ bool DisjunctionStep::shouldStopAt(const DisjunctionChoice &choice) const {
493493
bool DisjunctionStep::shortCircuitDisjunctionAt(
494494
Constraint *currentChoice, Constraint *lastSuccessfulChoice) const {
495495
auto &ctx = CS.getASTContext();
496-
if (ctx.LangOpts.DisableConstraintSolverPerformanceHacks)
497-
return false;
498496

499497
// If the successfully applied constraint is favored, we'll consider that to
500498
// be the "best".
@@ -515,6 +513,9 @@ bool DisjunctionStep::shortCircuitDisjunctionAt(
515513
if (currentChoice->getFix() && !lastSuccessfulChoice->getFix())
516514
return true;
517515

516+
if (ctx.LangOpts.DisableConstraintSolverPerformanceHacks)
517+
return false;
518+
518519
if (auto restriction = currentChoice->getRestriction()) {
519520
// Non-optional conversions are better than optional-to-optional
520521
// conversions.

0 commit comments

Comments
 (0)