[ConstraintSystem] Guard all the performance hacks with a flag

Package the flag into `performanceHacksEnabled()` method on
`ConstraintSystem` and start using it to wrap all of the hacks
in constraint generator and the solver.
This commit is contained in:
Pavel Yaskevich
2025-06-17 13:53:05 -07:00
parent 833b6b19e9
commit fc573b6612
7 changed files with 61 additions and 51 deletions

View File

@@ -638,9 +638,6 @@ bool DisjunctionStep::shouldSkip(const DisjunctionChoice &choice) const {
if (choice.isUnavailable() && !CS.shouldAttemptFixes())
return skip("unavailable");
if (ctx.TypeCheckerOpts.DisableConstraintSolverPerformanceHacks)
return false;
// If the solver already found a solution with a better overload choice that
// can be unconditionally substituted by the current choice, skip the current
// choice.
@@ -726,15 +723,10 @@ bool swift::isSIMDOperator(ValueDecl *value) {
bool DisjunctionStep::shortCircuitDisjunctionAt(
Constraint *currentChoice, Constraint *lastSuccessfulChoice) const {
auto &ctx = CS.getASTContext();
// Anything without a fix is better than anything with a fix.
if (currentChoice->getFix() && !lastSuccessfulChoice->getFix())
return true;
if (ctx.TypeCheckerOpts.DisableConstraintSolverPerformanceHacks)
return false;
if (auto restriction = currentChoice->getRestriction()) {
// Non-optional conversions are better than optional-to-optional
// conversions.