Merge pull request #82320 from xedin/hide-solver-hacks-behind-a-flag

[ConstraintSystem] Guard all the performance hacks with a flag
This commit is contained in:
Pavel Yaskevich
2025-06-20 00:12:16 -07:00
committed by GitHub
13 changed files with 64 additions and 64 deletions

View File

@@ -983,9 +983,6 @@ namespace swift {
/// is for testing purposes.
std::vector<std::string> DebugForbidTypecheckPrefixes;
/// Disable the shrink phase of the expression type checker.
bool SolverDisableShrink = false;
/// Enable experimental operator designated types feature.
bool EnableOperatorDesignatedTypes = false;

View File

@@ -856,10 +856,6 @@ def solver_scope_threshold_EQ : Joined<["-"], "solver-scope-threshold=">,
def solver_trail_threshold_EQ : Joined<["-"], "solver-trail-threshold=">,
HelpText<"Expression type checking trail change limit">;
def solver_disable_shrink :
Flag<["-"], "solver-disable-shrink">,
HelpText<"Disable the shrink phase of expression type checking">;
def solver_disable_splitter : Flag<["-"], "solver-disable-splitter">,
HelpText<"Disable the component splitter phase of expression type checking">;

View File

@@ -3586,6 +3586,13 @@ public:
return Options.contains(ConstraintSystemFlags::ForCodeCompletion);
}
/// Check whether type-checker performance hacks has been explicitly
/// disabled by a flag.
bool performanceHacksEnabled() const {
return !getASTContext()
.TypeCheckerOpts.DisableConstraintSolverPerformanceHacks;
}
/// Log and record the application of the fix. Return true iff any
/// subsequent solution would be worse than the best known solution.
bool recordFix(ConstraintFix *fix, unsigned impact = 1);