File tree Expand file tree Collapse file tree 4 files changed +33
-0
lines changed Expand file tree Collapse file tree 4 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -5691,6 +5691,11 @@ class ConstraintSystem {
5691
5691
// / Collect the current inactive disjunction constraints.
5692
5692
void collectDisjunctions (SmallVectorImpl<Constraint *> &disjunctions);
5693
5693
5694
+ // / Based on the given set of disjunctions, attempt to determine
5695
+ // / favored choices and perform other optimizations to help the
5696
+ // / solver.
5697
+ void optimizeDisjunctions (SmallVectorImpl<Constraint *> &disjunctions);
5698
+
5694
5699
// / Record a particular disjunction choice of
5695
5700
void recordDisjunctionChoice (ConstraintLocator *disjunctionLocator,
5696
5701
unsigned index) {
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ add_swift_host_library(swiftSema STATIC
10
10
CSSolver.cpp
11
11
CSStep.cpp
12
12
CSFix.cpp
13
+ CSOptimizer.cpp
13
14
CSDiagnostics.cpp
14
15
CodeSynthesis.cpp
15
16
CodeSynthesisDistributedActor.cpp
Original file line number Diff line number Diff line change
1
+ // ===--- CSOptimizer.cpp - Constraint Optimizer ---------------------------===//
2
+ //
3
+ // This source file is part of the Swift.org open source project
4
+ //
5
+ // Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
6
+ // Licensed under Apache License v2.0 with Runtime Library Exception
7
+ //
8
+ // See https://swift.org/LICENSE.txt for license information
9
+ // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10
+ //
11
+ // ===----------------------------------------------------------------------===//
12
+ //
13
+ // This file implements disjunction and other constraint optimizations.
14
+ //
15
+ // ===----------------------------------------------------------------------===//
16
+
17
+ #include " swift/Sema/ConstraintSystem.h"
18
+ #include " llvm/ADT/SmallVector.h"
19
+
20
+ using namespace swift ;
21
+ using namespace constraints ;
22
+
23
+ void ConstraintSystem::optimizeDisjunctions (
24
+ SmallVectorImpl<Constraint *> &disjunctions) {
25
+ }
Original file line number Diff line number Diff line change @@ -1773,6 +1773,8 @@ Constraint *ConstraintSystem::selectDisjunction() {
1773
1773
if (disjunctions.empty ())
1774
1774
return nullptr ;
1775
1775
1776
+ optimizeDisjunctions (disjunctions);
1777
+
1776
1778
if (auto *disjunction = selectBestBindingDisjunction (*this , disjunctions))
1777
1779
return disjunction;
1778
1780
You can’t perform that action at this time.
0 commit comments