Skip to content

Commit c04068d

Browse files
committed
[ConstraintSystem] Initial implementation of disjunction optimizer
This brings back CSOptimizer from swiftlang#63585
1 parent 0871358 commit c04068d

File tree

5 files changed

+1346
-6
lines changed

5 files changed

+1346
-6
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,10 @@ class TypeVariableType::Implementation {
491491
/// literal (represented by `ArrayExpr` and `DictionaryExpr` in AST).
492492
bool isCollectionLiteralType() const;
493493

494+
/// Determine whether this type variable represents a result type of a
495+
/// function call.
496+
bool isFunctionResult() const;
497+
494498
/// Retrieve the representative of the equivalence class to which this
495499
/// type variable belongs.
496500
///
@@ -5401,6 +5405,9 @@ class ConstraintSystem {
54015405
std::optional<std::pair<Constraint *, llvm::TinyPtrVector<Constraint *>>>
54025406
selectDisjunction();
54035407

5408+
/// The old method that is only used when performance hacks are enabled.
5409+
Constraint *selectDisjunctionWithHacks();
5410+
54045411
/// Pick a conjunction from the InactiveConstraints list.
54055412
///
54065413
/// \returns The selected conjunction.

lib/Sema/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ add_swift_host_library(swiftSema STATIC
1414
CSStep.cpp
1515
CSTrail.cpp
1616
CSFix.cpp
17+
CSOptimizer.cpp
1718
CSDiagnostics.cpp
1819
CodeSynthesis.cpp
1920
CodeSynthesisDistributedActor.cpp

0 commit comments

Comments
 (0)