mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user