|
15 | 15 | //===----------------------------------------------------------------------===//
|
16 | 16 |
|
17 | 17 | #define DEBUG_TYPE "cross-module-serialization-setup"
|
18 |
| -#include "swift/SILOptimizer/PassManager/Passes.h" |
19 |
| -#include "swift/SILOptimizer/PassManager/Transforms.h" |
20 |
| -#include "swift/SILOptimizer/Utils/InstOptUtils.h" |
| 18 | +#include "swift/AST/Module.h" |
21 | 19 | #include "swift/SIL/ApplySite.h"
|
| 20 | +#include "swift/SIL/SILCloner.h" |
22 | 21 | #include "swift/SIL/SILFunction.h"
|
23 | 22 | #include "swift/SIL/SILModule.h"
|
24 |
| -#include "swift/SIL/SILCloner.h" |
25 |
| -#include "swift/AST/Module.h" |
| 23 | +#include "swift/SILOptimizer/PassManager/Passes.h" |
| 24 | +#include "swift/SILOptimizer/PassManager/Transforms.h" |
| 25 | +#include "swift/SILOptimizer/Utils/InstOptUtils.h" |
| 26 | +#include "llvm/Support/CommandLine.h" |
26 | 27 | #include "llvm/Support/Debug.h"
|
27 | 28 |
|
28 | 29 | using namespace swift;
|
@@ -181,12 +182,19 @@ makeSubstUsableFromInline(const SubstitutionMap &substs) {
|
181 | 182 | }
|
182 | 183 | }
|
183 | 184 | }
|
| 185 | +static llvm::cl::opt<bool> SerializeEverything( |
| 186 | + "sil-cross-module-serialize-all", llvm::cl::init(false), |
| 187 | + llvm::cl::desc( |
| 188 | + "Serialize everything when performing cross module optimization in " |
| 189 | + "order to investigate performance differences caused by different " |
| 190 | + "@inlinable, @usableFromInline choices."), |
| 191 | + llvm::cl::Hidden); |
184 | 192 |
|
185 | 193 | /// Decide whether to serialize a function.
|
186 | 194 | static bool shouldSerialize(SILFunction *F) {
|
187 | 195 | // The basic heursitic: serialize all generic functions, because it makes a
|
188 | 196 | // huge difference if generic functions can be specialized or not.
|
189 |
| - if (!F->getLoweredFunctionType()->isPolymorphic()) |
| 197 | + if (!F->getLoweredFunctionType()->isPolymorphic() && !SerializeEverything) |
190 | 198 | return false;
|
191 | 199 |
|
192 | 200 | // Check if we already handled this function before.
|
|
0 commit comments