Remove the -enable-ossa-modules option.

OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
This commit is contained in:
Erik Eckstein
2025-09-24 08:41:01 +02:00
parent 887bfb7889
commit 2f124cf564
51 changed files with 95 additions and 275 deletions

View File

@@ -194,7 +194,6 @@ add_compile_options(
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>"
"$<$<COMPILE_LANGUAGE:Swift>:-no-link-objc-runtime>" "$<$<COMPILE_LANGUAGE:Swift>:-no-link-objc-runtime>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enforce-exclusivity=unchecked>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enforce-exclusivity=unchecked>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-ossa-modules>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -empty-abi-descriptor>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -empty-abi-descriptor>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>"
"$<$<AND:$<NOT:$<BOOL:${SwiftCore_ENABLE_OBJC_INTEROP}>>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -disable-objc-interop>" "$<$<AND:$<NOT:$<BOOL:${SwiftCore_ENABLE_OBJC_INTEROP}>>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -disable-objc-interop>"

View File

@@ -71,7 +71,6 @@ add_compile_options(
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-concurrency-module-import>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-concurrency-module-import>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enforce-exclusivity=unchecked>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enforce-exclusivity=unchecked>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-ossa-modules>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>" "$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>") "$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")

View File

@@ -81,7 +81,6 @@ add_compile_options(
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature Macros>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature Macros>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature ExtensionMacros>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature ExtensionMacros>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-lexical-lifetimes=false>" "$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-lexical-lifetimes=false>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-ossa-modules>"
"$<$<COMPILE_LANGUAGE:Swift>:-warn-implicit-overrides>" "$<$<COMPILE_LANGUAGE:Swift>:-warn-implicit-overrides>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>" "$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>") "$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")

View File

@@ -45,13 +45,12 @@ enum class CopyPropagationOption : uint8_t {
// Do not add any copy propagation passes. // Do not add any copy propagation passes.
Off = 0, Off = 0,
// Only add the copy propagation passes requested by other flags, currently // Only add the copy propagation passes requested by other flags.
// just -enable-ossa-modules.
RequestedPassesOnly, RequestedPassesOnly,
// Run copy propagation during optimized builds only. // Run copy propagation during optimized builds only.
// //
// If a setting, e.g. -enable-ossa-modules, requests to add copy propagation // If a setting, requests to add copy propagation
// to the performance pipeline, do so. // to the performance pipeline, do so.
Optimizing, Optimizing,
@@ -189,11 +188,6 @@ public:
/// and go from OSSA to non-ownership SIL. /// and go from OSSA to non-ownership SIL.
bool StopOptimizationBeforeLoweringOwnership = false; bool StopOptimizationBeforeLoweringOwnership = false;
/// Do we always serialize SIL in OSSA form?
///
/// If this is disabled we do not serialize in OSSA form when optimizing.
bool EnableOSSAModules = true;
/// Allow recompilation of a non-OSSA module to an OSSA module when imported /// Allow recompilation of a non-OSSA module to an OSSA module when imported
/// from another OSSA module. /// from another OSSA module.
bool EnableRecompilationToOSSAModule = false; bool EnableRecompilationToOSSAModule = false;

View File

@@ -478,25 +478,6 @@ public:
ModuleInterfaceLoaderOptions() = default; ModuleInterfaceLoaderOptions() = default;
}; };
/// Strongly typed enum that represents if we require all SILModules to have
/// OSSA modules emitted. This is implemented by incorporating this bit into the
/// module cache hash.
struct RequireOSSAModules_t {
enum ValueTy {
No = 0,
Yes = 1,
};
ValueTy value;
RequireOSSAModules_t(const SILOptions &opts)
: value(opts.EnableOSSAModules ? RequireOSSAModules_t::Yes
: RequireOSSAModules_t::No) {}
operator ValueTy() const { return value; }
explicit operator bool() const { return bool(value); }
};
class ModuleInterfaceCheckerImpl: public ModuleInterfaceChecker { class ModuleInterfaceCheckerImpl: public ModuleInterfaceChecker {
friend class ModuleInterfaceLoader; friend class ModuleInterfaceLoader;
ASTContext &Ctx; ASTContext &Ctx;
@@ -504,23 +485,20 @@ class ModuleInterfaceCheckerImpl: public ModuleInterfaceChecker {
std::string PrebuiltCacheDir; std::string PrebuiltCacheDir;
std::string BackupInterfaceDir; std::string BackupInterfaceDir;
ModuleInterfaceLoaderOptions Opts; ModuleInterfaceLoaderOptions Opts;
RequireOSSAModules_t RequiresOSSAModules;
public: public:
explicit ModuleInterfaceCheckerImpl(ASTContext &Ctx, StringRef cacheDir, explicit ModuleInterfaceCheckerImpl(ASTContext &Ctx, StringRef cacheDir,
StringRef prebuiltCacheDir, StringRef prebuiltCacheDir,
StringRef BackupInterfaceDir, StringRef BackupInterfaceDir,
ModuleInterfaceLoaderOptions opts, ModuleInterfaceLoaderOptions opts)
RequireOSSAModules_t requiresOSSAModules)
: Ctx(Ctx), CacheDir(cacheDir), PrebuiltCacheDir(prebuiltCacheDir), : Ctx(Ctx), CacheDir(cacheDir), PrebuiltCacheDir(prebuiltCacheDir),
BackupInterfaceDir(BackupInterfaceDir), BackupInterfaceDir(BackupInterfaceDir),
Opts(opts), RequiresOSSAModules(requiresOSSAModules) {} Opts(opts) {}
explicit ModuleInterfaceCheckerImpl(ASTContext &Ctx, StringRef cacheDir, explicit ModuleInterfaceCheckerImpl(ASTContext &Ctx, StringRef cacheDir,
StringRef prebuiltCacheDir, StringRef prebuiltCacheDir,
ModuleInterfaceLoaderOptions opts, ModuleInterfaceLoaderOptions opts):
RequireOSSAModules_t requiresOSSAModules):
ModuleInterfaceCheckerImpl(Ctx, cacheDir, prebuiltCacheDir, StringRef(), ModuleInterfaceCheckerImpl(Ctx, cacheDir, prebuiltCacheDir, StringRef(),
opts, requiresOSSAModules) {} opts) {}
std::vector<std::string> std::vector<std::string>
getCompiledModuleCandidatesForInterface(StringRef moduleName, getCompiledModuleCandidatesForInterface(StringRef moduleName,
StringRef interfacePath) override; StringRef interfacePath) override;
@@ -596,7 +574,6 @@ public:
ArrayRef<std::pair<std::string, std::string>> replayPrefixMap, ArrayRef<std::pair<std::string, std::string>> replayPrefixMap,
bool SerializeDependencyHashes, bool TrackSystemDependencies, bool SerializeDependencyHashes, bool TrackSystemDependencies,
ModuleInterfaceLoaderOptions Opts, ModuleInterfaceLoaderOptions Opts,
RequireOSSAModules_t RequireOSSAModules,
bool silenceInterfaceDiagnostics); bool silenceInterfaceDiagnostics);
/// Unconditionally build \p InPath (a swiftinterface file) to \p OutPath (as /// Unconditionally build \p InPath (a swiftinterface file) to \p OutPath (as
@@ -666,8 +643,7 @@ private:
const LangOptions &LangOpts, const LangOptions &LangOpts,
const ClangImporterOptions &clangImporterOpts, const ClangImporterOptions &clangImporterOpts,
const CASOptions &casOpts, const CASOptions &casOpts,
bool suppressRemarks, bool suppressRemarks);
RequireOSSAModules_t requireOSSAModules);
bool extractSwiftInterfaceVersionAndArgs(CompilerInvocation &subInvocation, bool extractSwiftInterfaceVersionAndArgs(CompilerInvocation &subInvocation,
DiagnosticEngine &subInstanceDiags, DiagnosticEngine &subInstanceDiags,
SwiftInterfaceInfo &interfaceInfo, SwiftInterfaceInfo &interfaceInfo,
@@ -684,7 +660,7 @@ public:
StringRef backupModuleInterfaceDir, StringRef backupModuleInterfaceDir,
ArrayRef<std::pair<std::string, std::string>> replayPrefixMap, ArrayRef<std::pair<std::string, std::string>> replayPrefixMap,
bool serializeDependencyHashes, bool serializeDependencyHashes,
bool trackSystemDependencies, RequireOSSAModules_t requireOSSAModules); bool trackSystemDependencies);
template<typename ...ArgTypes> template<typename ...ArgTypes>
static InFlightDiagnostic diagnose(StringRef interfacePath, static InFlightDiagnostic diagnose(StringRef interfacePath,

View File

@@ -1320,8 +1320,7 @@ def disable_ast_verifier : Flag<["-"], "disable-ast-verifier">,
let Flags = [FrontendOption, NoDriverOption, HelpHidden, ModuleInterfaceOptionIgnorable] in { let Flags = [FrontendOption, NoDriverOption, HelpHidden, ModuleInterfaceOptionIgnorable] in {
def enable_ossa_modules : Flag<["-"], "enable-ossa-modules">, def enable_ossa_modules : Flag<["-"], "enable-ossa-modules">,
HelpText<"Always serialize SIL in ossa form. If this flag is not passed in, " HelpText<"Obsolete. This option is ignored">;
"when optimizing ownership will be lowered before serializing SIL">;
} }
def enable_recompilation_to_ossa_module : Flag<["-"], "enable-recompilation-to-ossa-module">, def enable_recompilation_to_ossa_module : Flag<["-"], "enable-recompilation-to-ossa-module">,

View File

@@ -193,7 +193,6 @@ protected:
static llvm::ErrorOr<std::vector<ScannerImportStatementInfo>> static llvm::ErrorOr<std::vector<ScannerImportStatementInfo>>
getMatchingPackageOnlyImportsOfModule(Twine modulePath, getMatchingPackageOnlyImportsOfModule(Twine modulePath,
bool isFramework, bool isFramework,
bool isRequiredOSSAModules,
StringRef SDKName, StringRef SDKName,
const llvm::Triple &target, const llvm::Triple &target,
StringRef packageName, StringRef packageName,
@@ -222,8 +221,6 @@ public:
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer, std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
bool isFramework); bool isFramework);
bool isRequiredOSSAModules() const;
/// Check whether the module with a given name can be imported without /// Check whether the module with a given name can be imported without
/// importing it. /// importing it.
/// ///

View File

@@ -297,8 +297,6 @@ struct SearchPath {
/// ///
/// \param data A buffer containing the serialized AST. Result information /// \param data A buffer containing the serialized AST. Result information
/// refers directly into this buffer. /// refers directly into this buffer.
/// \param requiresOSSAModules If true, necessitates the module to be
/// compiled with -enable-ossa-modules.
/// \param requiredSDK If not empty, only accept modules built with /// \param requiredSDK If not empty, only accept modules built with
/// a compatible SDK. The StringRef represents the canonical SDK name. /// a compatible SDK. The StringRef represents the canonical SDK name.
/// \param target The target triple of the current compilation for /// \param target The target triple of the current compilation for
@@ -309,7 +307,7 @@ struct SearchPath {
/// \param[out] dependencies If present, will be populated with list of /// \param[out] dependencies If present, will be populated with list of
/// input files the module depends on, if present in INPUT_BLOCK. /// input files the module depends on, if present in INPUT_BLOCK.
ValidationInfo validateSerializedAST( ValidationInfo validateSerializedAST(
StringRef data, bool requiresOSSAModules, StringRef data,
StringRef requiredSDK, StringRef requiredSDK,
ExtendedValidationInfo *extendedInfo = nullptr, ExtendedValidationInfo *extendedInfo = nullptr,
SmallVectorImpl<SerializationOptions::FileDependency> *dependencies = SmallVectorImpl<SerializationOptions::FileDependency> *dependencies =

View File

@@ -58,7 +58,7 @@ swift::parseASTSection(MemoryBufferSerializedModuleLoader &Loader,
// headers. Iterate over all AST modules. // headers. Iterate over all AST modules.
while (!buf.empty()) { while (!buf.empty()) {
auto info = serialization::validateSerializedAST( auto info = serialization::validateSerializedAST(
buf, Loader.isRequiredOSSAModules(), buf,
/*requiredSDK*/StringRef()); /*requiredSDK*/StringRef());
assert(info.name.size() < (2 << 10) && "name failed sanity check"); assert(info.name.size() < (2 << 10) && "name failed sanity check");

View File

@@ -252,8 +252,8 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
workerCompilerInvocation->getFrontendOptions() workerCompilerInvocation->getFrontendOptions()
.SerializeModuleInterfaceDependencyHashes, .SerializeModuleInterfaceDependencyHashes,
workerCompilerInvocation->getFrontendOptions() workerCompilerInvocation->getFrontendOptions()
.shouldTrackSystemDependencies(), .shouldTrackSystemDependencies()
RequireOSSAModules_t(SILOptions)); );
auto loader = std::make_unique<PluginLoader>( auto loader = std::make_unique<PluginLoader>(
*workerASTContext, /*DepTracker=*/nullptr, *workerASTContext, /*DepTracker=*/nullptr,

View File

@@ -118,12 +118,6 @@ struct SILFuncExtractorOptions {
llvm::cl::init(false), llvm::cl::init(false),
llvm::cl::desc("Do not dump AST.")); llvm::cl::desc("Do not dump AST."));
llvm::cl::opt<bool> EnableOSSAModules = llvm::cl::opt<bool>(
"enable-ossa-modules", llvm::cl::init(true),
llvm::cl::desc("Do we always serialize SIL in OSSA form? If "
"this is disabled we do not serialize in OSSA "
"form when optimizing."));
llvm::cl::opt<llvm::cl::boolOrDefault> llvm::cl::opt<llvm::cl::boolOrDefault>
EnableObjCInterop = llvm::cl::opt<llvm::cl::boolOrDefault>( EnableObjCInterop = llvm::cl::opt<llvm::cl::boolOrDefault>(
"enable-objc-interop", "enable-objc-interop",
@@ -275,7 +269,6 @@ int sil_func_extractor_main(ArrayRef<const char *> argv, void *MainAddr) {
SILOptions &Opts = Invocation.getSILOptions(); SILOptions &Opts = Invocation.getSILOptions();
Opts.EmitVerboseSIL = options.EmitVerboseSIL; Opts.EmitVerboseSIL = options.EmitVerboseSIL;
Opts.EmitSortedSIL = options.EmitSortedSIL; Opts.EmitSortedSIL = options.EmitSortedSIL;
Opts.EnableOSSAModules = options.EnableOSSAModules;
Opts.StopOptimizationAfterSerialization |= options.EmitSIB; Opts.StopOptimizationAfterSerialization |= options.EmitSIB;
serialization::ExtendedValidationInfo extendedInfo; serialization::ExtendedValidationInfo extendedInfo;
@@ -368,7 +361,7 @@ int sil_func_extractor_main(ArrayRef<const char *> argv, void *MainAddr) {
serializationOpts.OutputPath = OutputFile; serializationOpts.OutputPath = OutputFile;
serializationOpts.SerializeAllSIL = true; serializationOpts.SerializeAllSIL = true;
serializationOpts.IsSIB = true; serializationOpts.IsSIB = true;
serializationOpts.IsOSSA = options.EnableOSSAModules; serializationOpts.IsOSSA = true;
symbolgraphgen::SymbolGraphOptions symbolGraphOpts; symbolgraphgen::SymbolGraphOptions symbolGraphOpts;

View File

@@ -316,12 +316,6 @@ struct SILOptOptions {
EnableMoveInoutStackProtection = llvm::cl::opt<bool>("enable-move-inout-stack-protector", EnableMoveInoutStackProtection = llvm::cl::opt<bool>("enable-move-inout-stack-protector",
llvm::cl::desc("Enable the stack protector by moving values to temporaries.")); llvm::cl::desc("Enable the stack protector by moving values to temporaries."));
llvm::cl::opt<bool> EnableOSSAModules = llvm::cl::opt<bool>(
"enable-ossa-modules", llvm::cl::init(true),
llvm::cl::desc("Do we always serialize SIL in OSSA form? If "
"this is disabled we do not serialize in OSSA "
"form when optimizing."));
cl::opt<EnforceExclusivityMode> cl::opt<EnforceExclusivityMode>
EnforceExclusivity = cl::opt<EnforceExclusivityMode>( EnforceExclusivity = cl::opt<EnforceExclusivityMode>(
"enforce-exclusivity", cl::desc("Enforce law of exclusivity " "enforce-exclusivity", cl::desc("Enforce law of exclusivity "
@@ -902,7 +896,6 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
SILOpts.EnableThrowsPrediction = options.EnableThrowsPrediction; SILOpts.EnableThrowsPrediction = options.EnableThrowsPrediction;
SILOpts.EnableNoReturnCold = options.EnableNoReturnCold; SILOpts.EnableNoReturnCold = options.EnableNoReturnCold;
SILOpts.IgnoreAlwaysInline = options.IgnoreAlwaysInline; SILOpts.IgnoreAlwaysInline = options.IgnoreAlwaysInline;
SILOpts.EnableOSSAModules = options.EnableOSSAModules;
SILOpts.EnableSILOpaqueValues = options.EnableSILOpaqueValues; SILOpts.EnableSILOpaqueValues = options.EnableSILOpaqueValues;
SILOpts.OSSACompleteLifetimes = options.EnableOSSACompleteLifetimes; SILOpts.OSSACompleteLifetimes = options.EnableOSSACompleteLifetimes;
SILOpts.OSSAVerifyComplete = options.EnableOSSAVerifyComplete; SILOpts.OSSAVerifyComplete = options.EnableOSSAVerifyComplete;
@@ -1088,7 +1081,7 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
serializationOpts.OutputPath = OutputFile; serializationOpts.OutputPath = OutputFile;
serializationOpts.SerializeAllSIL = options.EmitSIB; serializationOpts.SerializeAllSIL = options.EmitSIB;
serializationOpts.IsSIB = options.EmitSIB; serializationOpts.IsSIB = options.EmitSIB;
serializationOpts.IsOSSA = SILOpts.EnableOSSAModules; serializationOpts.IsOSSA = true;
symbolgraphgen::SymbolGraphOptions symbolGraphOptions; symbolgraphgen::SymbolGraphOptions symbolGraphOptions;

View File

@@ -3047,7 +3047,6 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
enablePackMetadataStackPromotionFlag.value(); enablePackMetadataStackPromotionFlag.value();
Opts.EnableARCOptimizations &= !Args.hasArg(OPT_disable_arc_opts); Opts.EnableARCOptimizations &= !Args.hasArg(OPT_disable_arc_opts);
Opts.EnableOSSAModules |= Args.hasArg(OPT_enable_ossa_modules);
Opts.EnableRecompilationToOSSAModule |= Opts.EnableRecompilationToOSSAModule |=
Args.hasArg(OPT_enable_recompilation_to_ossa_module); Args.hasArg(OPT_enable_recompilation_to_ossa_module);
Opts.EnableOSSAOptimizations &= !Args.hasArg(OPT_disable_ossa_opts); Opts.EnableOSSAOptimizations &= !Args.hasArg(OPT_disable_ossa_opts);
@@ -4190,8 +4189,6 @@ bool CompilerInvocation::parseArgs(
SILOpts.CMOMode = CrossModuleOptimizationMode::Everything; SILOpts.CMOMode = CrossModuleOptimizationMode::Everything;
SILOpts.EmbeddedSwift = true; SILOpts.EmbeddedSwift = true;
SILOpts.UseAggressiveReg2MemForCodeSize = true; SILOpts.UseAggressiveReg2MemForCodeSize = true;
// OSSA modules are required for deinit de-virtualization.
SILOpts.EnableOSSAModules = true;
// -g is promoted to -gdwarf-types in embedded Swift // -g is promoted to -gdwarf-types in embedded Swift
if (IRGenOpts.DebugInfoLevel == IRGenDebugInfoLevel::ASTTypes) { if (IRGenOpts.DebugInfoLevel == IRGenDebugInfoLevel::ASTTypes) {
IRGenOpts.DebugInfoLevel = IRGenDebugInfoLevel::DwarfTypes; IRGenOpts.DebugInfoLevel = IRGenDebugInfoLevel::DwarfTypes;
@@ -4244,7 +4241,6 @@ CompilerInvocation::loadFromSerializedAST(StringRef data) {
serialization::ValidationInfo info = serialization::ValidationInfo info =
serialization::validateSerializedAST( serialization::validateSerializedAST(
data, data,
getSILOptions().EnableOSSAModules,
LangOpts.SDKName, LangOpts.SDKName,
&extendedInfo); &extendedInfo);
@@ -4282,7 +4278,6 @@ CompilerInvocation::setUpInputForSILTool(
auto result = serialization::validateSerializedAST( auto result = serialization::validateSerializedAST(
fileBufOrErr.get()->getBuffer(), fileBufOrErr.get()->getBuffer(),
getSILOptions().EnableOSSAModules,
LangOpts.SDKName, LangOpts.SDKName,
&extendedInfo); &extendedInfo);
bool hasSerializedAST = result.status == serialization::Status::Valid; bool hasSerializedAST = result.status == serialization::Status::Valid;

View File

@@ -281,7 +281,7 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
serializationOpts.SerializeDebugInfoSIL = true; serializationOpts.SerializeDebugInfoSIL = true;
} }
serializationOpts.IsOSSA = getSILOptions().EnableOSSAModules; serializationOpts.IsOSSA = true;
serializationOpts.SkipNonExportableDecls = serializationOpts.SkipNonExportableDecls =
getLangOptions().SkipNonExportableDecls; getLangOptions().SkipNonExportableDecls;
@@ -792,8 +792,7 @@ bool CompilerInstance::setUpModuleLoaders() {
Context->addModuleInterfaceChecker( Context->addModuleInterfaceChecker(
std::make_unique<ModuleInterfaceCheckerImpl>( std::make_unique<ModuleInterfaceCheckerImpl>(
*Context, ModuleCachePathFromInvocation, FEOpts.PrebuiltModuleCachePath, *Context, ModuleCachePathFromInvocation, FEOpts.PrebuiltModuleCachePath,
FEOpts.BackupModuleInterfaceDir, LoaderOpts, FEOpts.BackupModuleInterfaceDir, LoaderOpts));
RequireOSSAModules_t(Invocation.getSILOptions())));
if (MLM != ModuleLoadingMode::OnlySerialized) { if (MLM != ModuleLoadingMode::OnlySerialized) {
// We only need ModuleInterfaceLoader for implicit modules. // We only need ModuleInterfaceLoader for implicit modules.
@@ -867,8 +866,7 @@ bool CompilerInstance::setUpModuleLoaders() {
Context->addModuleInterfaceChecker( Context->addModuleInterfaceChecker(
std::make_unique<ModuleInterfaceCheckerImpl>( std::make_unique<ModuleInterfaceCheckerImpl>(
*Context, ModuleCachePath, FEOpts.PrebuiltModuleCachePath, *Context, ModuleCachePath, FEOpts.PrebuiltModuleCachePath,
FEOpts.BackupModuleInterfaceDir, LoaderOpts, FEOpts.BackupModuleInterfaceDir, LoaderOpts));
RequireOSSAModules_t(Invocation.getSILOptions())));
// Install an explicit module loader if it was created earlier. // Install an explicit module loader if it was created earlier.
if (ESML) { if (ESML) {
@@ -910,8 +908,7 @@ bool CompilerInstance::setUpModuleLoaders() {
FEOpts.PrebuiltModuleCachePath, FEOpts.BackupModuleInterfaceDir, FEOpts.PrebuiltModuleCachePath, FEOpts.BackupModuleInterfaceDir,
FEOpts.CacheReplayPrefixMap, FEOpts.CacheReplayPrefixMap,
FEOpts.SerializeModuleInterfaceDependencyHashes, FEOpts.SerializeModuleInterfaceDependencyHashes,
FEOpts.shouldTrackSystemDependencies(), FEOpts.shouldTrackSystemDependencies());
RequireOSSAModules_t(Invocation.getSILOptions()));
} }
return false; return false;

View File

@@ -310,7 +310,7 @@ std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface(
return std::make_error_code(std::errc::not_supported); return std::make_error_code(std::errc::not_supported);
SerializationOpts.Dependencies = Deps; SerializationOpts.Dependencies = Deps;
} }
SerializationOpts.IsOSSA = SILOpts.EnableOSSAModules; SerializationOpts.IsOSSA = true;
SILMod->setSerializeSILAction([&]() { SILMod->setSerializeSILAction([&]() {
// We don't want to serialize module docs in the cache -- they // We don't want to serialize module docs in the cache -- they

View File

@@ -213,10 +213,8 @@ public:
namespace path = llvm::sys::path; namespace path = llvm::sys::path;
static bool serializedASTLooksValid(const llvm::MemoryBuffer &buf, static bool serializedASTLooksValid(const llvm::MemoryBuffer &buf,
bool requiresOSSAModules,
StringRef requiredSDK) { StringRef requiredSDK) {
auto VI = serialization::validateSerializedAST(buf.getBuffer(), auto VI = serialization::validateSerializedAST(buf.getBuffer(),
requiresOSSAModules,
requiredSDK); requiredSDK);
return VI.status == serialization::Status::Valid; return VI.status == serialization::Status::Valid;
} }
@@ -408,14 +406,11 @@ StringRef getFullDependencyPath(const FileDependency &dep,
class UpToDateModuleCheker { class UpToDateModuleCheker {
ASTContext &ctx; ASTContext &ctx;
llvm::vfs::FileSystem &fs; llvm::vfs::FileSystem &fs;
RequireOSSAModules_t requiresOSSAModules;
public: public:
UpToDateModuleCheker(ASTContext &ctx, UpToDateModuleCheker(ASTContext &ctx)
RequireOSSAModules_t requiresOSSAModules)
: ctx(ctx), : ctx(ctx),
fs(*ctx.SourceMgr.getFileSystem()), fs(*ctx.SourceMgr.getFileSystem()) {}
requiresOSSAModules(requiresOSSAModules) {}
// Check if all the provided file dependencies are up-to-date compared to // Check if all the provided file dependencies are up-to-date compared to
// what's currently on disk. // what's currently on disk.
@@ -460,7 +455,7 @@ public:
LLVM_DEBUG(llvm::dbgs() << "Validating deps of " << path << "\n"); LLVM_DEBUG(llvm::dbgs() << "Validating deps of " << path << "\n");
auto validationInfo = serialization::validateSerializedAST( auto validationInfo = serialization::validateSerializedAST(
buf.getBuffer(), requiresOSSAModules, buf.getBuffer(),
ctx.LangOpts.SDKName, /*ExtendedValidationInfo=*/nullptr, &allDeps); ctx.LangOpts.SDKName, /*ExtendedValidationInfo=*/nullptr, &allDeps);
if (validationInfo.status != serialization::Status::Valid) { if (validationInfo.status != serialization::Status::Valid) {
@@ -551,25 +546,22 @@ class ModuleInterfaceLoaderImpl {
DependencyTracker *const dependencyTracker; DependencyTracker *const dependencyTracker;
const ModuleLoadingMode loadMode; const ModuleLoadingMode loadMode;
ModuleInterfaceLoaderOptions Opts; ModuleInterfaceLoaderOptions Opts;
RequireOSSAModules_t requiresOSSAModules;
ModuleInterfaceLoaderImpl( ModuleInterfaceLoaderImpl(
ASTContext &ctx, StringRef modulePath, StringRef interfacePath, ASTContext &ctx, StringRef modulePath, StringRef interfacePath,
StringRef moduleName, StringRef cacheDir, StringRef prebuiltCacheDir, StringRef moduleName, StringRef cacheDir, StringRef prebuiltCacheDir,
StringRef backupInterfaceDir, StringRef backupInterfaceDir,
SourceLoc diagLoc, ModuleInterfaceLoaderOptions Opts, SourceLoc diagLoc, ModuleInterfaceLoaderOptions Opts,
RequireOSSAModules_t requiresOSSAModules,
DependencyTracker *dependencyTracker = nullptr, DependencyTracker *dependencyTracker = nullptr,
ModuleLoadingMode loadMode = ModuleLoadingMode::PreferSerialized) ModuleLoadingMode loadMode = ModuleLoadingMode::PreferSerialized)
: ctx(ctx), fs(*ctx.SourceMgr.getFileSystem()), diags(ctx.Diags), : ctx(ctx), fs(*ctx.SourceMgr.getFileSystem()), diags(ctx.Diags),
upToDateChecker(ctx, requiresOSSAModules), upToDateChecker(ctx),
modulePath(modulePath), interfacePath(interfacePath), modulePath(modulePath), interfacePath(interfacePath),
moduleName(moduleName), moduleName(moduleName),
prebuiltCacheDir(prebuiltCacheDir), prebuiltCacheDir(prebuiltCacheDir),
backupInterfaceDir(backupInterfaceDir), backupInterfaceDir(backupInterfaceDir),
cacheDir(cacheDir), diagnosticLoc(diagLoc), cacheDir(cacheDir), diagnosticLoc(diagLoc),
dependencyTracker(dependencyTracker), loadMode(loadMode), Opts(Opts), dependencyTracker(dependencyTracker), loadMode(loadMode), Opts(Opts) {}
requiresOSSAModules(requiresOSSAModules) {}
std::string getBackupPublicModuleInterfacePath() { std::string getBackupPublicModuleInterfacePath() {
return getBackupPublicModuleInterfacePath(ctx.SourceMgr, backupInterfaceDir, return getBackupPublicModuleInterfacePath(ctx.SourceMgr, backupInterfaceDir,
@@ -622,7 +614,6 @@ class ModuleInterfaceLoaderImpl {
return false; return false;
auto looksValid = serializedASTLooksValid(*modBuf.get(), auto looksValid = serializedASTLooksValid(*modBuf.get(),
requiresOSSAModules,
ctx.LangOpts.SDKName); ctx.LangOpts.SDKName);
if (!looksValid) if (!looksValid)
return false; return false;
@@ -935,15 +926,7 @@ class ModuleInterfaceLoaderImpl {
version::getCurrentCompilerSerializationTag().empty() && version::getCurrentCompilerSerializationTag().empty() &&
rebuildInfo.getOrInsertCandidateModule(adjacentMod) rebuildInfo.getOrInsertCandidateModule(adjacentMod)
.serializationStatus != .serializationStatus !=
serialization::Status::SDKMismatch && serialization::Status::SDKMismatch) {
// FIXME (meg-gupta): We need to support recompilation of
// modules in the resource directory if the mismatch is due
// to importing a non-ossa module to an ossa module. This is
// needed during ossa bringup, once -enable-ossa-modules is
// on by default, this can be deleted.
rebuildInfo.getOrInsertCandidateModule(adjacentMod)
.serializationStatus !=
serialization::Status::NotInOSSA) {
// Special-case here: If we're loading a .swiftmodule from the resource // Special-case here: If we're loading a .swiftmodule from the resource
// dir adjacent to the compiler, defer to the serialized loader instead // dir adjacent to the compiler, defer to the serialized loader instead
// of falling back. This is to support local development of Swift, // of falling back. This is to support local development of Swift,
@@ -1130,8 +1113,7 @@ class ModuleInterfaceLoaderImpl {
ctx.ClangImporterOpts, ctx.CASOpts, Opts, ctx.ClangImporterOpts, ctx.CASOpts, Opts,
/*buildModuleCacheDirIfAbsent*/ true, cacheDir, prebuiltCacheDir, /*buildModuleCacheDirIfAbsent*/ true, cacheDir, prebuiltCacheDir,
backupInterfaceDir, /*replayPrefixMap=*/{}, backupInterfaceDir, /*replayPrefixMap=*/{},
/*serializeDependencyHashes*/ false, trackSystemDependencies, /*serializeDependencyHashes*/ false, trackSystemDependencies);
requiresOSSAModules);
// Compute the output path if we're loading or emitting a cached module. // Compute the output path if we're loading or emitting a cached module.
SwiftInterfaceModuleOutputPathResolution::ResultTy resolvedOutputPath; SwiftInterfaceModuleOutputPathResolution::ResultTy resolvedOutputPath;
@@ -1375,7 +1357,6 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory(
Ctx, ModPath, *InPath, ModuleName, InterfaceChecker.CacheDir, Ctx, ModPath, *InPath, ModuleName, InterfaceChecker.CacheDir,
InterfaceChecker.PrebuiltCacheDir, InterfaceChecker.BackupInterfaceDir, InterfaceChecker.PrebuiltCacheDir, InterfaceChecker.BackupInterfaceDir,
ModuleID.Loc, InterfaceChecker.Opts, ModuleID.Loc, InterfaceChecker.Opts,
InterfaceChecker.RequiresOSSAModules,
dependencyTracker, dependencyTracker,
llvm::is_contained(PreferInterfaceForModules, ModuleName) llvm::is_contained(PreferInterfaceForModules, ModuleName)
? ModuleLoadingMode::PreferInterface ? ModuleLoadingMode::PreferInterface
@@ -1429,7 +1410,7 @@ ModuleInterfaceCheckerImpl::getCompiledModuleCandidatesForInterface(
ModuleInterfaceLoaderImpl Impl(Ctx, modulePath, interfacePath, moduleName, ModuleInterfaceLoaderImpl Impl(Ctx, modulePath, interfacePath, moduleName,
CacheDir, PrebuiltCacheDir, BackupInterfaceDir, CacheDir, PrebuiltCacheDir, BackupInterfaceDir,
SourceLoc(), Opts, RequiresOSSAModules, SourceLoc(), Opts,
nullptr, Ctx.SearchPathOpts.ModuleLoadMode); nullptr, Ctx.SearchPathOpts.ModuleLoadMode);
std::vector<std::string> results; std::vector<std::string> results;
std::string adjacentMod, prebuiltMod; std::string adjacentMod, prebuiltMod;
@@ -1469,7 +1450,6 @@ bool ModuleInterfaceCheckerImpl::tryEmitForwardingModule(
ModuleInterfaceLoaderImpl Impl(Ctx, modulePath, interfacePath, moduleName, ModuleInterfaceLoaderImpl Impl(Ctx, modulePath, interfacePath, moduleName,
CacheDir, PrebuiltCacheDir, CacheDir, PrebuiltCacheDir,
BackupInterfaceDir, SourceLoc(), Opts, BackupInterfaceDir, SourceLoc(), Opts,
RequiresOSSAModules,
nullptr, nullptr,
ModuleLoadingMode::PreferSerialized); ModuleLoadingMode::PreferSerialized);
SmallVector<FileDependency, 16> deps; SmallVector<FileDependency, 16> deps;
@@ -1503,13 +1483,13 @@ bool ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface(
ArrayRef<std::pair<std::string, std::string>> replayPrefixMap, ArrayRef<std::pair<std::string, std::string>> replayPrefixMap,
bool SerializeDependencyHashes, bool TrackSystemDependencies, bool SerializeDependencyHashes, bool TrackSystemDependencies,
ModuleInterfaceLoaderOptions LoaderOpts, ModuleInterfaceLoaderOptions LoaderOpts,
RequireOSSAModules_t RequireOSSAModules, bool silenceInterfaceDiagnostics) { bool silenceInterfaceDiagnostics) {
InterfaceSubContextDelegateImpl astDelegate( InterfaceSubContextDelegateImpl astDelegate(
SourceMgr, &Diags, SearchPathOpts, LangOpts, ClangOpts, CASOpts, SourceMgr, &Diags, SearchPathOpts, LangOpts, ClangOpts, CASOpts,
LoaderOpts, LoaderOpts,
/*CreateCacheDirIfAbsent*/ true, CacheDir, PrebuiltCacheDir, /*CreateCacheDirIfAbsent*/ true, CacheDir, PrebuiltCacheDir,
BackupInterfaceDir, replayPrefixMap, SerializeDependencyHashes, BackupInterfaceDir, replayPrefixMap, SerializeDependencyHashes,
TrackSystemDependencies, RequireOSSAModules); TrackSystemDependencies);
ImplicitModuleInterfaceBuilder builder(SourceMgr, &Diags, astDelegate, InPath, ImplicitModuleInterfaceBuilder builder(SourceMgr, &Diags, astDelegate, InPath,
SearchPathOpts.getSDKPath(), SearchPathOpts.getSDKPath(),
SearchPathOpts.getSysRoot(), SearchPathOpts.getSysRoot(),
@@ -1635,8 +1615,7 @@ bool ModuleInterfaceLoader::buildExplicitSwiftModuleFromSwiftInterface(
// up-to-date w.r.t. all of the dependencies it was built with. If so, early // up-to-date w.r.t. all of the dependencies it was built with. If so, early
// exit. // exit.
UpToDateModuleCheker checker( UpToDateModuleCheker checker(
Instance.getASTContext(), Instance.getASTContext());
RequireOSSAModules_t(Instance.getSILOptions()));
ModuleRebuildInfo rebuildInfo; ModuleRebuildInfo rebuildInfo;
SmallVector<FileDependency, 3> allDeps; SmallVector<FileDependency, 3> allDeps;
std::unique_ptr<llvm::MemoryBuffer> moduleBuffer; std::unique_ptr<llvm::MemoryBuffer> moduleBuffer;
@@ -1684,7 +1663,7 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
FrontendOptions::ActionType requestedAction, FrontendOptions::ActionType requestedAction,
const SearchPathOptions &SearchPathOpts, const LangOptions &LangOpts, const SearchPathOptions &SearchPathOpts, const LangOptions &LangOpts,
const ClangImporterOptions &clangImporterOpts, const CASOptions &casOpts, const ClangImporterOptions &clangImporterOpts, const CASOptions &casOpts,
bool suppressRemarks, RequireOSSAModules_t RequireOSSAModules) { bool suppressRemarks) {
GenericArgs.push_back("-frontend"); GenericArgs.push_back("-frontend");
// Start with a genericSubInvocation that copies various state from our // Start with a genericSubInvocation that copies various state from our
// invoking ASTContext. // invoking ASTContext.
@@ -1791,12 +1770,6 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface(
genericSubInvocation.getLangOptions().EnableObjCAttrRequiresFoundation = false; genericSubInvocation.getLangOptions().EnableObjCAttrRequiresFoundation = false;
GenericArgs.push_back("-disable-objc-attr-requires-foundation-module"); GenericArgs.push_back("-disable-objc-attr-requires-foundation-module");
// If we are supposed to use RequireOSSAModules, do so.
if (RequireOSSAModules) {
genericSubInvocation.getSILOptions().EnableOSSAModules = true;
GenericArgs.push_back("-enable-ossa-modules");
}
if (LangOpts.DisableAvailabilityChecking) { if (LangOpts.DisableAvailabilityChecking) {
genericSubInvocation.getLangOptions().DisableAvailabilityChecking = true; genericSubInvocation.getLangOptions().DisableAvailabilityChecking = true;
GenericArgs.push_back("-disable-availability-checking"); GenericArgs.push_back("-disable-availability-checking");
@@ -1885,14 +1858,12 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl(
StringRef moduleCachePath, StringRef prebuiltCachePath, StringRef moduleCachePath, StringRef prebuiltCachePath,
StringRef backupModuleInterfaceDir, StringRef backupModuleInterfaceDir,
ArrayRef<std::pair<std::string, std::string>> replayPrefixMap, ArrayRef<std::pair<std::string, std::string>> replayPrefixMap,
bool serializeDependencyHashes, bool trackSystemDependencies, bool serializeDependencyHashes, bool trackSystemDependencies)
RequireOSSAModules_t requireOSSAModules)
: SM(SM), Diags(Diags), ArgSaver(Allocator) { : SM(SM), Diags(Diags), ArgSaver(Allocator) {
genericSubInvocation.setMainExecutablePath(LoaderOpts.mainExecutablePath); genericSubInvocation.setMainExecutablePath(LoaderOpts.mainExecutablePath);
inheritOptionsForBuildingInterface(LoaderOpts.requestedAction, searchPathOpts, inheritOptionsForBuildingInterface(LoaderOpts.requestedAction, searchPathOpts,
langOpts, clangImporterOpts, casOpts, langOpts, clangImporterOpts, casOpts,
Diags->getSuppressRemarks(), Diags->getSuppressRemarks());
requireOSSAModules);
// Configure front-end input. // Configure front-end input.
auto &SubFEOpts = genericSubInvocation.getFrontendOptions(); auto &SubFEOpts = genericSubInvocation.getFrontendOptions();
SubFEOpts.RequestedAction = LoaderOpts.requestedAction; SubFEOpts.RequestedAction = LoaderOpts.requestedAction;
@@ -2447,7 +2418,6 @@ bool ExplicitSwiftModuleLoader::canImportModule(
auto metaData = serialization::validateSerializedAST( auto metaData = serialization::validateSerializedAST(
(*moduleBuf)->getBuffer(), (*moduleBuf)->getBuffer(),
Ctx.SILOpts.EnableOSSAModules,
Ctx.LangOpts.SDKName); Ctx.LangOpts.SDKName);
versionInfo->setVersion(metaData.userModuleVersion, versionInfo->setVersion(metaData.userModuleVersion,
ModuleVersionSourceKind::SwiftBinaryModule); ModuleVersionSourceKind::SwiftBinaryModule);
@@ -2802,7 +2772,7 @@ bool ExplicitCASModuleLoader::canImportModule(
return false; return false;
} }
auto metaData = serialization::validateSerializedAST( auto metaData = serialization::validateSerializedAST(
moduleBuf->getBuffer(), Ctx.SILOpts.EnableOSSAModules, moduleBuf->getBuffer(),
Ctx.LangOpts.SDKName); Ctx.LangOpts.SDKName);
versionInfo->setVersion(metaData.userModuleVersion, versionInfo->setVersion(metaData.userModuleVersion,
ModuleVersionSourceKind::SwiftBinaryModule); ModuleVersionSourceKind::SwiftBinaryModule);
@@ -2915,12 +2885,6 @@ static std::string getContextHash(const CompilerInvocation &CI,
// Application extension. // Application extension.
unsigned(CI.getLangOptions().EnableAppExtensionRestrictions), unsigned(CI.getLangOptions().EnableAppExtensionRestrictions),
// Whether or not OSSA modules are enabled.
//
// If OSSA modules are enabled, we use a separate namespace of modules to
// ensure that we compile all swift interface files with the option set.
unsigned(CI.getSILOptions().EnableOSSAModules),
// Is the C++ interop enabled? // Is the C++ interop enabled?
unsigned(CI.getLangOptions().EnableCXXInterop), unsigned(CI.getLangOptions().EnableCXXInterop),

View File

@@ -391,7 +391,7 @@ static bool buildModuleFromInterface(CompilerInstance &Instance) {
Invocation.getOutputFilename(), ABIPath, FEOpts.CacheReplayPrefixMap, Invocation.getOutputFilename(), ABIPath, FEOpts.CacheReplayPrefixMap,
FEOpts.SerializeModuleInterfaceDependencyHashes, FEOpts.SerializeModuleInterfaceDependencyHashes,
FEOpts.shouldTrackSystemDependencies(), LoaderOpts, FEOpts.shouldTrackSystemDependencies(), LoaderOpts,
RequireOSSAModules_t(Invocation.getSILOptions()), IgnoreAdjacentModules); IgnoreAdjacentModules);
} }
static bool compileLLVMIR(CompilerInstance &Instance) { static bool compileLLVMIR(CompilerInstance &Instance) {
@@ -1754,7 +1754,7 @@ static bool serializeSIB(SILModule *SM, const PrimarySpecificPaths &PSPs,
serializationOpts.OutputPath = moduleOutputPath; serializationOpts.OutputPath = moduleOutputPath;
serializationOpts.SerializeAllSIL = true; serializationOpts.SerializeAllSIL = true;
serializationOpts.IsSIB = true; serializationOpts.IsSIB = true;
serializationOpts.IsOSSA = Context.SILOpts.EnableOSSAModules; serializationOpts.IsOSSA = true;
symbolgraphgen::SymbolGraphOptions symbolGraphOptions; symbolgraphgen::SymbolGraphOptions symbolGraphOptions;

View File

@@ -543,16 +543,6 @@ void addFunctionPasses(SILPassPipelinePlan &P,
P.addSemanticARCOpts(); P.addSemanticARCOpts();
P.addCopyToBorrowOptimization(); P.addCopyToBorrowOptimization();
if (!P.getOptions().EnableOSSAModules) {
if (P.getOptions().StopOptimizationBeforeLoweringOwnership)
return;
if (SILPrintFinalOSSAModule) {
addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
}
P.addNonTransparentFunctionOwnershipModelEliminator();
}
switch (OpLevel) { switch (OpLevel) {
case OptimizationLevelKind::HighLevel: case OptimizationLevelKind::HighLevel:
// Does not inline functions with defined semantics or effects. // Does not inline functions with defined semantics or effects.
@@ -566,13 +556,11 @@ void addFunctionPasses(SILPassPipelinePlan &P,
} }
// Clean up Semantic ARC before we perform additional post-inliner opts. // Clean up Semantic ARC before we perform additional post-inliner opts.
if (P.getOptions().EnableOSSAModules) { if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) { P.addCopyPropagation();
P.addCopyPropagation();
}
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
} }
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
// Promote stack allocations to values and eliminate redundant // Promote stack allocations to values and eliminate redundant
// loads. // loads.
@@ -633,14 +621,12 @@ void addFunctionPasses(SILPassPipelinePlan &P,
P.addARCSequenceOpts(); P.addARCSequenceOpts();
// Run a final round of ARC opts when ownership is enabled. // Run a final round of ARC opts when ownership is enabled.
if (P.getOptions().EnableOSSAModules) { P.addDestroyHoisting();
P.addDestroyHoisting(); if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) { P.addCopyPropagation();
P.addCopyPropagation();
}
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
} }
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
} }
static void addPerfDebugSerializationPipeline(SILPassPipelinePlan &P) { static void addPerfDebugSerializationPipeline(SILPassPipelinePlan &P) {
@@ -1022,13 +1008,11 @@ SILPassPipelinePlan::getPerformancePassPipeline(const SILOptions &Options) {
// Run one last copy propagation/semantic arc opts run before serialization/us // Run one last copy propagation/semantic arc opts run before serialization/us
// lowering ownership. // lowering ownership.
if (P.getOptions().EnableOSSAModules) { if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) {
if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) { P.addCopyPropagation();
P.addCopyPropagation();
}
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
} }
P.addSemanticARCOpts();
P.addCopyToBorrowOptimization();
P.addCrossModuleOptimization(); P.addCrossModuleOptimization();
@@ -1042,10 +1026,9 @@ SILPassPipelinePlan::getPerformancePassPipeline(const SILOptions &Options) {
if (Options.StopOptimizationAfterSerialization) if (Options.StopOptimizationAfterSerialization)
return P; return P;
if (P.getOptions().EnableOSSAModules && SILPrintFinalOSSAModule) { if (SILPrintFinalOSSAModule) {
addModulePrinterPipeline(P, "SIL Print Final OSSA Module"); addModulePrinterPipeline(P, "SIL Print Final OSSA Module");
} }
// Strip any transparent functions that still have ownership.
P.addOwnershipModelEliminator(); P.addOwnershipModelEliminator();
P.addAutodiffClosureSpecialization(); P.addAutodiffClosureSpecialization();
@@ -1126,7 +1109,6 @@ SILPassPipelinePlan::getOnonePassPipeline(const SILOptions &Options) {
if (P.Options.StopOptimizationBeforeLoweringOwnership) if (P.Options.StopOptimizationBeforeLoweringOwnership)
return P; return P;
// Now strip any transparent functions that still have ownership.
P.addOwnershipModelEliminator(); P.addOwnershipModelEliminator();
// Finally perform some small transforms. // Finally perform some small transforms.

View File

@@ -669,10 +669,8 @@ class SILCombine : public SILFunctionTransform {
void run() override { void run() override {
bool enableCopyPropagation = bool enableCopyPropagation =
getOptions().CopyPropagation >= CopyPropagationOption::Optimizing; getOptions().CopyPropagation >= CopyPropagationOption::Optimizing;
if (getOptions().EnableOSSAModules) { enableCopyPropagation =
enableCopyPropagation = getOptions().CopyPropagation != CopyPropagationOption::Off;
getOptions().CopyPropagation != CopyPropagationOption::Off;
}
SILCombiner Combiner(this, getOptions().RemoveRuntimeAsserts, SILCombiner Combiner(this, getOptions().RemoveRuntimeAsserts,
enableCopyPropagation); enableCopyPropagation);

View File

@@ -426,7 +426,7 @@ ModuleFile::getModuleName(ASTContext &Ctx, StringRef modulePath,
bool isFramework = false; bool isFramework = false;
serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load(
"", "", std::move(newBuf), nullptr, nullptr, "", "", std::move(newBuf), nullptr, nullptr,
/*isFramework=*/isFramework, Ctx.SILOpts.EnableOSSAModules, /*isFramework=*/isFramework,
Ctx.LangOpts.SDKName, Ctx.LangOpts.Target, Ctx.LangOpts.SDKName, Ctx.LangOpts.Target,
Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFile); Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFile);
Name = loadedModuleFile->Name.str(); Name = loadedModuleFile->Name.str();

View File

@@ -242,7 +242,6 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor,
static ValidationInfo validateControlBlock( static ValidationInfo validateControlBlock(
llvm::BitstreamCursor &cursor, SmallVectorImpl<uint64_t> &scratch, llvm::BitstreamCursor &cursor, SmallVectorImpl<uint64_t> &scratch,
std::pair<uint16_t, uint16_t> expectedVersion, std::pair<uint16_t, uint16_t> expectedVersion,
bool requiresOSSAModules,
bool requiresRevisionMatch, bool requiresRevisionMatch,
StringRef requiredSDK, StringRef requiredSDK,
std::optional<llvm::Triple> target, std::optional<llvm::Triple> target,
@@ -486,7 +485,7 @@ static ValidationInfo validateControlBlock(
} }
case control_block::IS_OSSA: { case control_block::IS_OSSA: {
auto isModuleInOSSA = scratch[0]; auto isModuleInOSSA = scratch[0];
if (requiresOSSAModules && !isModuleInOSSA) if (!isModuleInOSSA)
result.status = Status::NotInOSSA; result.status = Status::NotInOSSA;
break; break;
} }
@@ -615,7 +614,7 @@ bool serialization::isSerializedAST(StringRef data) {
} }
ValidationInfo serialization::validateSerializedAST( ValidationInfo serialization::validateSerializedAST(
StringRef data, bool requiresOSSAModules, StringRef data,
StringRef requiredSDK, StringRef requiredSDK,
ExtendedValidationInfo *extendedInfo, ExtendedValidationInfo *extendedInfo,
SmallVectorImpl<SerializationOptions::FileDependency> *dependencies, SmallVectorImpl<SerializationOptions::FileDependency> *dependencies,
@@ -661,7 +660,6 @@ ValidationInfo serialization::validateSerializedAST(
result = validateControlBlock( result = validateControlBlock(
cursor, scratch, cursor, scratch,
{SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR}, {SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR},
requiresOSSAModules,
/*requiresRevisionMatch=*/true, /*requiresRevisionMatch=*/true,
requiredSDK, target, requiredSDK, target,
extendedInfo, localObfuscator); extendedInfo, localObfuscator);
@@ -1213,7 +1211,6 @@ bool ModuleFileSharedCore::readModuleDocIfPresent(PathObfuscator &pathRecoverer)
info = validateControlBlock( info = validateControlBlock(
docCursor, scratch, {SWIFTDOC_VERSION_MAJOR, SWIFTDOC_VERSION_MINOR}, docCursor, scratch, {SWIFTDOC_VERSION_MAJOR, SWIFTDOC_VERSION_MINOR},
RequiresOSSAModules,
/*requiresRevisionMatch*/false, /*requiresRevisionMatch*/false,
/*requiredSDK*/StringRef(), /*target*/std::nullopt, /*requiredSDK*/StringRef(), /*target*/std::nullopt,
/*extendedInfo*/nullptr, pathRecoverer); /*extendedInfo*/nullptr, pathRecoverer);
@@ -1359,7 +1356,6 @@ bool ModuleFileSharedCore::readModuleSourceInfoIfPresent(PathObfuscator &pathRec
info = validateControlBlock( info = validateControlBlock(
infoCursor, scratch, infoCursor, scratch,
{SWIFTSOURCEINFO_VERSION_MAJOR, SWIFTSOURCEINFO_VERSION_MINOR}, {SWIFTSOURCEINFO_VERSION_MAJOR, SWIFTSOURCEINFO_VERSION_MINOR},
RequiresOSSAModules,
/*requiresRevisionMatch*/false, /*requiresRevisionMatch*/false,
/*requiredSDK*/StringRef(), /*target*/std::nullopt, /*requiredSDK*/StringRef(), /*target*/std::nullopt,
/*extendedInfo*/nullptr, pathRecoverer); /*extendedInfo*/nullptr, pathRecoverer);
@@ -1439,14 +1435,12 @@ ModuleFileSharedCore::ModuleFileSharedCore(
std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer, std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer,
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer, std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
bool isFramework, bool isFramework,
bool requiresOSSAModules,
StringRef requiredSDK, StringRef requiredSDK,
std::optional<llvm::Triple> target, std::optional<llvm::Triple> target,
serialization::ValidationInfo &info, PathObfuscator &pathRecoverer) serialization::ValidationInfo &info, PathObfuscator &pathRecoverer)
: ModuleInputBuffer(std::move(moduleInputBuffer)), : ModuleInputBuffer(std::move(moduleInputBuffer)),
ModuleDocInputBuffer(std::move(moduleDocInputBuffer)), ModuleDocInputBuffer(std::move(moduleDocInputBuffer)),
ModuleSourceInfoInputBuffer(std::move(moduleSourceInfoInputBuffer)), ModuleSourceInfoInputBuffer(std::move(moduleSourceInfoInputBuffer)) {
RequiresOSSAModules(requiresOSSAModules) {
assert(!hasError()); assert(!hasError());
Bits.IsFramework = isFramework; Bits.IsFramework = isFramework;
@@ -1493,7 +1487,6 @@ ModuleFileSharedCore::ModuleFileSharedCore(
info = validateControlBlock( info = validateControlBlock(
cursor, scratch, cursor, scratch,
{SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR}, {SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR},
RequiresOSSAModules,
/*requiresRevisionMatch=*/true, requiredSDK, target, /*requiresRevisionMatch=*/true, requiredSDK, target,
&extInfo, pathRecoverer); &extInfo, pathRecoverer);
if (info.status != Status::Valid) { if (info.status != Status::Valid) {

View File

@@ -114,9 +114,6 @@ class ModuleFileSharedCore {
/// \c true if this module has incremental dependency information. /// \c true if this module has incremental dependency information.
bool HasIncrementalInfo = false; bool HasIncrementalInfo = false;
/// \c true if this module was compiled with -enable-ossa-modules.
bool RequiresOSSAModules;
/// An array of module names that are allowed to import this one. /// An array of module names that are allowed to import this one.
ArrayRef<StringRef> AllowableClientNames; ArrayRef<StringRef> AllowableClientNames;
@@ -445,7 +442,6 @@ private:
std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer, std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer,
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer, std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
bool isFramework, bool isFramework,
bool requiresOSSAModules,
StringRef requiredSDK, StringRef requiredSDK,
std::optional<llvm::Triple> target, std::optional<llvm::Triple> target,
serialization::ValidationInfo &info, PathObfuscator &pathRecoverer); serialization::ValidationInfo &info, PathObfuscator &pathRecoverer);
@@ -573,8 +569,6 @@ public:
/// of the buffer, even if there's an error in loading. /// of the buffer, even if there's an error in loading.
/// \param isFramework If true, this is treated as a framework module for /// \param isFramework If true, this is treated as a framework module for
/// linking purposes. /// linking purposes.
/// \param requiresOSSAModules If true, this requires dependent modules to be
/// compiled with -enable-ossa-modules.
/// \param requiredSDK A string denoting the name of the currently-used SDK, /// \param requiredSDK A string denoting the name of the currently-used SDK,
/// to ensure that the loaded module was built with a compatible SDK. /// to ensure that the loaded module was built with a compatible SDK.
/// \param target The target triple of the current compilation for /// \param target The target triple of the current compilation for
@@ -587,7 +581,7 @@ public:
std::unique_ptr<llvm::MemoryBuffer> moduleInputBuffer, std::unique_ptr<llvm::MemoryBuffer> moduleInputBuffer,
std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer, std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer,
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer, std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
bool isFramework, bool requiresOSSAModules, bool isFramework,
StringRef requiredSDK, std::optional<llvm::Triple> target, StringRef requiredSDK, std::optional<llvm::Triple> target,
PathObfuscator &pathRecoverer, PathObfuscator &pathRecoverer,
std::shared_ptr<const ModuleFileSharedCore> &theModule) { std::shared_ptr<const ModuleFileSharedCore> &theModule) {
@@ -595,7 +589,7 @@ public:
auto *core = new ModuleFileSharedCore( auto *core = new ModuleFileSharedCore(
std::move(moduleInputBuffer), std::move(moduleDocInputBuffer), std::move(moduleInputBuffer), std::move(moduleDocInputBuffer),
std::move(moduleSourceInfoInputBuffer), isFramework, std::move(moduleSourceInfoInputBuffer), isFramework,
requiresOSSAModules, requiredSDK, target, info, requiredSDK, target, info,
pathRecoverer); pathRecoverer);
if (!moduleInterfacePath.empty()) { if (!moduleInterfacePath.empty()) {
ArrayRef<char> path; ArrayRef<char> path;

View File

@@ -252,7 +252,7 @@ SwiftModuleScanner::scanInterfaceFile(Identifier moduleID,
if (adjacentBinaryModule != compiledCandidates.end()) { if (adjacentBinaryModule != compiledCandidates.end()) {
auto adjacentBinaryModulePackageOnlyImports = auto adjacentBinaryModulePackageOnlyImports =
getMatchingPackageOnlyImportsOfModule( getMatchingPackageOnlyImportsOfModule(
*adjacentBinaryModule, isFramework, isRequiredOSSAModules(), *adjacentBinaryModule, isFramework,
Ctx.LangOpts.SDKName, Ctx.LangOpts.Target, Ctx.LangOpts.SDKName, Ctx.LangOpts.Target,
ScannerPackageName, Ctx.SourceMgr.getFileSystem().get(), ScannerPackageName, Ctx.SourceMgr.getFileSystem().get(),
Ctx.SearchPathOpts.DeserializedPathRecoverer); Ctx.SearchPathOpts.DeserializedPathRecoverer);
@@ -294,7 +294,7 @@ llvm::ErrorOr<ModuleDependencyInfo> SwiftModuleScanner::scanBinaryModuleFile(
std::shared_ptr<const ModuleFileSharedCore> loadedModuleFile; std::shared_ptr<const ModuleFileSharedCore> loadedModuleFile;
serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load(
"", "", std::move(moduleBuf.get()), nullptr, nullptr, isFramework, "", "", std::move(moduleBuf.get()), nullptr, nullptr, isFramework,
isRequiredOSSAModules(), Ctx.LangOpts.SDKName, Ctx.LangOpts.Target, Ctx.LangOpts.SDKName, Ctx.LangOpts.Target,
Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFile); Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFile);
if (Ctx.SearchPathOpts.ScannerModuleValidation) { if (Ctx.SearchPathOpts.ScannerModuleValidation) {

View File

@@ -343,7 +343,7 @@ std::optional<std::string> SerializedModuleLoaderBase::invalidModuleReason(seria
llvm::ErrorOr<std::vector<ScannerImportStatementInfo>> llvm::ErrorOr<std::vector<ScannerImportStatementInfo>>
SerializedModuleLoaderBase::getMatchingPackageOnlyImportsOfModule( SerializedModuleLoaderBase::getMatchingPackageOnlyImportsOfModule(
Twine modulePath, bool isFramework, bool isRequiredOSSAModules, Twine modulePath, bool isFramework,
StringRef SDKName, const llvm::Triple &target, StringRef packageName, StringRef SDKName, const llvm::Triple &target, StringRef packageName,
llvm::vfs::FileSystem *fileSystem, PathObfuscator &recoverer) { llvm::vfs::FileSystem *fileSystem, PathObfuscator &recoverer) {
auto moduleBuf = fileSystem->getBufferForFile(modulePath); auto moduleBuf = fileSystem->getBufferForFile(modulePath);
@@ -355,7 +355,7 @@ SerializedModuleLoaderBase::getMatchingPackageOnlyImportsOfModule(
std::shared_ptr<const ModuleFileSharedCore> loadedModuleFile; std::shared_ptr<const ModuleFileSharedCore> loadedModuleFile;
serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load(
"", "", std::move(moduleBuf.get()), nullptr, nullptr, isFramework, "", "", std::move(moduleBuf.get()), nullptr, nullptr, isFramework,
isRequiredOSSAModules, SDKName, target, recoverer, loadedModuleFile); SDKName, target, recoverer, loadedModuleFile);
if (loadedModuleFile->getModulePackageName() != packageName) if (loadedModuleFile->getModulePackageName() != packageName)
return importedModuleNames; return importedModuleNames;
@@ -953,7 +953,6 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
moduleInterfacePath, moduleInterfaceSourcePath, moduleInterfacePath, moduleInterfaceSourcePath,
std::move(moduleInputBuffer), std::move(moduleDocInputBuffer), std::move(moduleInputBuffer), std::move(moduleDocInputBuffer),
std::move(moduleSourceInfoInputBuffer), isFramework, std::move(moduleSourceInfoInputBuffer), isFramework,
isRequiredOSSAModules(),
Ctx.LangOpts.SDKName, Ctx.LangOpts.Target, Ctx.LangOpts.SDKName, Ctx.LangOpts.Target,
Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFileCore); Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFileCore);
SerializedASTFile *fileUnit = nullptr; SerializedASTFile *fileUnit = nullptr;
@@ -1113,10 +1112,6 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
return fileUnit; return fileUnit;
} }
bool SerializedModuleLoaderBase::isRequiredOSSAModules() const {
return Ctx.SILOpts.EnableOSSAModules;
}
void swift::serialization::diagnoseSerializedASTLoadFailure( void swift::serialization::diagnoseSerializedASTLoadFailure(
ASTContext &Ctx, SourceLoc diagLoc, ASTContext &Ctx, SourceLoc diagLoc,
const serialization::ValidationInfo &loadInfo, const serialization::ValidationInfo &loadInfo,
@@ -1155,12 +1150,9 @@ void swift::serialization::diagnoseSerializedASTLoadFailure(
moduleBufferID); moduleBufferID);
break; break;
case serialization::Status::NotInOSSA: case serialization::Status::NotInOSSA:
if (Ctx.SerializationOpts.ExplicitModuleBuild || Ctx.Diags.diagnose(diagLoc,
Ctx.SILOpts.EnableOSSAModules) { diag::serialization_non_ossa_module_incompatible,
Ctx.Diags.diagnose(diagLoc, ModuleName);
diag::serialization_non_ossa_module_incompatible,
ModuleName);
}
break; break;
case serialization::Status::RevisionIncompatible: case serialization::Status::RevisionIncompatible:
Ctx.Diags.diagnose(diagLoc, diag::serialization_module_incompatible_revision, Ctx.Diags.diagnose(diagLoc, diag::serialization_module_incompatible_revision,
@@ -1498,7 +1490,7 @@ std::unique_ptr<llvm::MemoryBuffer> swift::extractEmbeddedBridgingHeaderContent(
std::shared_ptr<const ModuleFileSharedCore> loadedModuleFile; std::shared_ptr<const ModuleFileSharedCore> loadedModuleFile;
serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load(
"", "", std::move(file), nullptr, nullptr, false, "", "", std::move(file), nullptr, nullptr, false,
Context.SILOpts.EnableOSSAModules, Context.LangOpts.SDKName, Context.LangOpts.SDKName,
Context.LangOpts.Target, Context.LangOpts.Target,
Context.SearchPathOpts.DeserializedPathRecoverer, Context.SearchPathOpts.DeserializedPathRecoverer,
loadedModuleFile); loadedModuleFile);
@@ -1553,7 +1545,7 @@ bool SerializedModuleLoaderBase::canImportModule(
if (moduleInputBuffer) { if (moduleInputBuffer) {
auto metaData = serialization::validateSerializedAST( auto metaData = serialization::validateSerializedAST(
moduleInputBuffer->getBuffer(), Ctx.SILOpts.EnableOSSAModules, moduleInputBuffer->getBuffer(),
Ctx.LangOpts.SDKName); Ctx.LangOpts.SDKName);
// If we only found binary module, make sure that is valid. // If we only found binary module, make sure that is valid.

View File

@@ -1920,9 +1920,6 @@ endfunction()
# INSTALL_WITH_SHARED # INSTALL_WITH_SHARED
# Install a static library target alongside shared libraries # Install a static library target alongside shared libraries
# #
# IMPORTS_NON_OSSA
# Imports a non-ossa module
#
# MACCATALYST_BUILD_FLAVOR # MACCATALYST_BUILD_FLAVOR
# Possible values are 'ios-like', 'macos-like', 'zippered', 'unzippered-twin' # Possible values are 'ios-like', 'macos-like', 'zippered', 'unzippered-twin'
# Presence of a build flavor requires SWIFT_MODULE_DEPENDS_MACCATALYST to be # Presence of a build flavor requires SWIFT_MODULE_DEPENDS_MACCATALYST to be
@@ -1984,8 +1981,7 @@ function(add_swift_target_library name)
SHARED SHARED
STATIC STATIC
NO_LINK_NAME NO_LINK_NAME
INSTALL_WITH_SHARED INSTALL_WITH_SHARED)
IMPORTS_NON_OSSA)
set(SWIFTLIB_single_parameter_options set(SWIFTLIB_single_parameter_options
DEPLOYMENT_VERSION_IOS DEPLOYMENT_VERSION_IOS
DEPLOYMENT_VERSION_OSX DEPLOYMENT_VERSION_OSX
@@ -2150,10 +2146,6 @@ function(add_swift_target_library name)
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-enable-lexical-lifetimes=false") list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-enable-lexical-lifetimes=false")
endif() endif()
if (NOT SWIFTLIB_IMPORTS_NON_OSSA)
list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-enable-ossa-modules")
endif()
if(NOT DEFINED SWIFTLIB_INSTALL_BINARY_SWIFTMODULE) if(NOT DEFINED SWIFTLIB_INSTALL_BINARY_SWIFTMODULE)
set(SWIFTLIB_INSTALL_BINARY_SWIFTMODULE TRUE) set(SWIFTLIB_INSTALL_BINARY_SWIFTMODULE TRUE)
endif() endif()

View File

@@ -25,7 +25,7 @@ set(swift_distributed_link_libraries
swiftCore) swiftCore)
add_swift_target_library(swiftDistributed ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IMPORTS_NON_OSSA add_swift_target_library(swiftDistributed ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
DistributedActor.cpp DistributedActor.cpp
DistributedActor.swift DistributedActor.swift
DistributedActorSystem.swift DistributedActorSystem.swift

View File

@@ -96,7 +96,7 @@ set(SWIFT_SYNCHRNOIZATION_SWIFT_FLAGS
"-strict-memory-safety" "-strict-memory-safety"
) )
add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IMPORTS_NON_OSSA add_swift_target_library(swiftSynchronization ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
${SWIFT_SYNCHRONIZATION_SOURCES} ${SWIFT_SYNCHRONIZATION_SOURCES}
GYB_SOURCES GYB_SOURCES

View File

@@ -536,7 +536,6 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB)
GYB_SOURCES ${SWIFTLIB_EMBEDDED_GYB_SOURCES} GYB_SOURCES ${SWIFTLIB_EMBEDDED_GYB_SOURCES}
SWIFT_COMPILE_FLAGS SWIFT_COMPILE_FLAGS
${swift_stdlib_compile_flags} -Xcc -ffreestanding -enable-experimental-feature Embedded ${swift_stdlib_compile_flags} -Xcc -ffreestanding -enable-experimental-feature Embedded
-Xfrontend -enable-ossa-modules
MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded" MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded"
SDK "embedded" SDK "embedded"
ARCHITECTURE "${arch}" ARCHITECTURE "${arch}"

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend %s -emit-sil -g -Osize -parse-stdlib -parse-as-library -enable-ossa-modules -o - | %FileCheck %s // RUN: %target-swift-frontend %s -emit-sil -g -Osize -parse-stdlib -parse-as-library -o - | %FileCheck %s
// REQUIRES: asserts // REQUIRES: asserts

View File

@@ -1,6 +1,5 @@
// RUN: %target-run-simple-swift(-Xfrontend -sil-verify-all) // RUN: %target-run-simple-swift(-Xfrontend -sil-verify-all)
// RUN: %target-run-simple-swift(-O -Xfrontend -sil-verify-all) // RUN: %target-run-simple-swift(-O -Xfrontend -sil-verify-all)
// RUN: %target-run-simple-swift(-O -Xfrontend -sil-verify-all -Xfrontend -enable-ossa-modules)
// REQUIRES: executable_test // REQUIRES: executable_test

View File

@@ -6,7 +6,6 @@
// RUN: %FileCheck %s --check-prefix=CHECK-IR // RUN: %FileCheck %s --check-prefix=CHECK-IR
// RUN: %target-run-simple-swift(-parse-as-library -enable-builtin-module -Xfrontend -sil-verify-all) | %FileCheck %s // RUN: %target-run-simple-swift(-parse-as-library -enable-builtin-module -Xfrontend -sil-verify-all) | %FileCheck %s
// RUN: %target-run-simple-swift(-O -parse-as-library -enable-builtin-module -Xfrontend -sil-verify-all) | %FileCheck %s // RUN: %target-run-simple-swift(-O -parse-as-library -enable-builtin-module -Xfrontend -sil-verify-all) | %FileCheck %s
// RUN: %target-run-simple-swift(-O -parse-as-library -enable-builtin-module -Xfrontend -sil-verify-all -Xfrontend -enable-ossa-modules) | %FileCheck %s
// REQUIRES: executable_test // REQUIRES: executable_test

View File

@@ -13,7 +13,7 @@
// RUN: %empty-directory(%t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule) // RUN: %empty-directory(%t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule)
// RUN: %empty-directory(%t/PreBuiltSDKModules) // RUN: %empty-directory(%t/PreBuiltSDKModules)
// RUN: %target-swift-frontend -c -emit-module-interface-path %t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule/%target-swiftinterface-name -emit-module-path %t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule/%target-swiftmodule-name -o %t/Swift.o -parse-stdlib -module-name Swift -enable-library-evolution -module-cache-path %t/TempModuleCacheLibrary -swift-version 5 %s -disable-objc-interop -enable-ossa-modules // RUN: %target-swift-frontend -c -emit-module-interface-path %t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule/%target-swiftinterface-name -emit-module-path %t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule/%target-swiftmodule-name -o %t/Swift.o -parse-stdlib -module-name Swift -enable-library-evolution -module-cache-path %t/TempModuleCacheLibrary -swift-version 5 %s -disable-objc-interop
// RUN: %swift_build_sdk_interfaces_base -o %t/PreBuiltSDKModules -j 1 -sdk %t/SDK -module-cache-path %t/TempModuleCacheBuilder %t/SDK -v // RUN: %swift_build_sdk_interfaces_base -o %t/PreBuiltSDKModules -j 1 -sdk %t/SDK -module-cache-path %t/TempModuleCacheBuilder %t/SDK -v
@@ -23,7 +23,7 @@
// In this case also, we should not rebuild. // In this case also, we should not rebuild.
// RUN: %target-swift-frontend -typecheck -sdk '%t/SDK' -prebuilt-module-cache-path '%t/PreBuiltSDKModules' -module-cache-path %t/TempModuleCacheOther -resource-dir '' -parse-stdlib -Rmodule-interface-rebuild %S/Inputs/sdk-test-stdlib-no-ossa-referent-no-rebuild-remark.swift -verify -enable-ossa-modules // RUN: %target-swift-frontend -typecheck -sdk '%t/SDK' -prebuilt-module-cache-path '%t/PreBuiltSDKModules' -module-cache-path %t/TempModuleCacheOther -resource-dir '' -parse-stdlib -Rmodule-interface-rebuild %S/Inputs/sdk-test-stdlib-no-ossa-referent-no-rebuild-remark.swift -verify
// Flaky hangs: rdar://77288690 // Flaky hangs: rdar://77288690
// UNSUPPORTED: CPU=arm64, CPU=arm64e // UNSUPPORTED: CPU=arm64, CPU=arm64e

View File

@@ -1,6 +1,6 @@
// RUN: %empty-directory(%t) // RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %S/Inputs/shared_function_serialization_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -O -enable-ossa-modules // RUN: %target-swift-frontend %S/Inputs/shared_function_serialization_input.swift -o %t/Swift.swiftmodule -emit-module -parse-as-library -parse-stdlib -module-link-name swiftCore -module-name Swift -O
// RUN: %target-sil-opt -enable-sil-verify-all -I %t -performance-linker -enable-ossa-modules -inline %s -o - | %FileCheck %s // RUN: %target-sil-opt -enable-sil-verify-all -I %t -performance-linker -inline %s -o - | %FileCheck %s
// CHECK: sil private @top_level_code // CHECK: sil private @top_level_code
// CHECK: sil public_external [serialized] [ossa] @$ss1XVABycfC{{.*}} // CHECK: sil public_external [serialized] [ossa] @$ss1XVABycfC{{.*}}

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -O -parse-as-library -emit-sil -enable-ossa-modules %s | %FileCheck %s // RUN: %target-swift-frontend -O -parse-as-library -emit-sil %s | %FileCheck %s
// REQUIRES: PTRSIZE=32,swift_stdlib_asserts // REQUIRES: PTRSIZE=32,swift_stdlib_asserts
import Swift import Swift

View File

@@ -1,7 +1,7 @@
// RUN: %target-sil-opt -diagnostics -enable-sil-opaque-values %s | \ // RUN: %target-sil-opt -diagnostics -enable-sil-opaque-values %s | \
// RUN: %target-sil-opt -Onone-performance -enable-sil-verify-all \ // RUN: %target-sil-opt -Onone-performance -enable-sil-verify-all \
// RUN: -enable-sil-opaque-values -emit-sorted-sil \ // RUN: -enable-sil-opaque-values -emit-sorted-sil \
// RUN: -enable-ossa-modules -enable-copy-propagation \ // RUN: -enable-copy-propagation \
// RUN: -enable-lexical-borrow-scopes | \ // RUN: -enable-lexical-borrow-scopes | \
// RUN: %FileCheck %s // RUN: %FileCheck %s
// //

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -emit-sil -O -enable-ossa-modules -sil-verify-all %s // RUN: %target-swift-frontend -emit-sil -O -sil-verify-all %s
// REQUIRES: OS=macosx // REQUIRES: OS=macosx
import Foundation import Foundation

View File

@@ -1,8 +1,6 @@
// RUN: %target-swift-frontend -Osize -import-objc-header %S/Inputs/Outliner.h %s -Xllvm -sil-print-types -emit-sil -enforce-exclusivity=unchecked -enable-copy-propagation | %FileCheck %s // RUN: %target-swift-frontend -Osize -import-objc-header %S/Inputs/Outliner.h %s -Xllvm -sil-print-types -emit-sil -enforce-exclusivity=unchecked -enable-copy-propagation | %FileCheck %s
// RUN: %target-swift-frontend -Osize -g -import-objc-header %S/Inputs/Outliner.h %s -Xllvm -sil-print-types -emit-sil -enforce-exclusivity=unchecked -enable-copy-propagation | %FileCheck %s // RUN: %target-swift-frontend -Osize -g -import-objc-header %S/Inputs/Outliner.h %s -Xllvm -sil-print-types -emit-sil -enforce-exclusivity=unchecked -enable-copy-propagation | %FileCheck %s
// RUN: %target-swift-frontend -Osize -import-objc-header %S/Inputs/Outliner.h %s -Xllvm -sil-print-types -emit-sil -enforce-exclusivity=unchecked -enable-copy-propagation -enable-ossa-modules | %FileCheck %s
// RUN: %target-swift-frontend -Osize -g -import-objc-header %S/Inputs/Outliner.h %s -Xllvm -sil-print-types -emit-sil -enforce-exclusivity=unchecked -enable-copy-propagation -enable-ossa-modules | %FileCheck %s
// REQUIRES: objc_interop // REQUIRES: objc_interop
// REQUIRES: optimized_stdlib // REQUIRES: optimized_stdlib
// REQUIRES: swift_in_compiler // REQUIRES: swift_in_compiler

View File

@@ -1,5 +1,4 @@
// RUN: %target-swift-frontend %s -O -Xllvm -sil-print-types -emit-sil | %FileCheck %s // RUN: %target-swift-frontend %s -O -Xllvm -sil-print-types -emit-sil | %FileCheck %s
// RUN: %target-swift-frontend %s -O -Xllvm -sil-print-types -enable-ossa-modules -emit-sil | %FileCheck %s
func curry<T1, T2, T3, T4>(_ f: @escaping (T1, T2, T3) -> T4) -> (T1) -> (T2) -> (T3) -> T4 { func curry<T1, T2, T3, T4>(_ f: @escaping (T1, T2, T3) -> T4) -> (T1) -> (T2) -> (T3) -> T4 {
return { x in { y in { z in f(x, y, z) } } } return { x in { y in { z in f(x, y, z) } } }

View File

@@ -1,4 +1,4 @@
// RUN: %target-sil-opt -sil-print-types -enable-ossa-modules -enable-copy-propagation -enable-lexical-lifetimes=false -enable-sil-verify-all %s -sil-combine -sil-combine-disable-alloc-stack-opts | %FileCheck %s // RUN: %target-sil-opt -sil-print-types -enable-copy-propagation -enable-lexical-lifetimes=false -enable-sil-verify-all %s -sil-combine -sil-combine-disable-alloc-stack-opts | %FileCheck %s
import Swift import Swift
import Builtin import Builtin

View File

@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -O -enable-ossa-modules -Xllvm -sil-print-types -emit-sil -sil-verify-all -Xllvm -sil-disable-pass=function-signature-opts %s | %FileCheck %s // RUN: %target-swift-frontend -O -Xllvm -sil-print-types -emit-sil -sil-verify-all -Xllvm -sil-disable-pass=function-signature-opts %s | %FileCheck %s
// RUN: %target-swift-frontend -O -enable-ossa-modules -Xllvm -sil-print-types -emit-sil -Xllvm -sil-verify-force-analysis-around-pass=devirtualizer -Xllvm -sil-disable-pass=function-signature-opts %s | %FileCheck %s // RUN: %target-swift-frontend -O -Xllvm -sil-print-types -emit-sil -Xllvm -sil-verify-force-analysis-around-pass=devirtualizer -Xllvm -sil-disable-pass=function-signature-opts %s | %FileCheck %s
// REQUIRES: swift_in_compiler // REQUIRES: swift_in_compiler

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -O %s -enable-ossa-modules -emit-sil -o /dev/null // RUN: %target-swift-frontend -O %s -emit-sil -o /dev/null
public class X {} public class X {}

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -O -Xllvm -sil-print-types -emit-sil -disable-availability-checking -enable-ossa-modules %s | %IRGenFileCheck %s // RUN: %target-swift-frontend -O -Xllvm -sil-print-types -emit-sil -disable-availability-checking %s | %IRGenFileCheck %s
// REQUIRES: synchronization // REQUIRES: synchronization

View File

@@ -1,5 +1,4 @@
// RUN: %target-build-swift -O %s -module-name=test -Xfrontend -sil-verify-all -emit-sil | %FileCheck %s // RUN: %target-build-swift -O %s -module-name=test -Xfrontend -sil-verify-all -emit-sil | %FileCheck %s
// RUN: %target-build-swift -O %s -module-name=test -Xfrontend -sil-verify-all -emit-sil -Xfrontend -enable-ossa-modules | %FileCheck %s
// RUN: %empty-directory(%t) // RUN: %empty-directory(%t)
// RUN: %target-build-swift -O -module-name=test %s -o %t/a.out // RUN: %target-build-swift -O -module-name=test %s -o %t/a.out

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -module-name=test -O -enable-ossa-modules -Xllvm -sil-print-types -emit-sil %s | %FileCheck %s // RUN: %target-swift-frontend -module-name=test -O -Xllvm -sil-print-types -emit-sil %s | %FileCheck %s
// RUN: %empty-directory(%t) // RUN: %empty-directory(%t)
// RUN: %target-build-swift -O -module-name=test %s -o %t/a.out // RUN: %target-build-swift -O -module-name=test %s -o %t/a.out

View File

@@ -1,21 +0,0 @@
// REQUIRES: objc_interop
// RUN: %empty-directory(%t)
// RUN: mkdir -p %t/clang-module-cache
// RUN: mkdir -p %t/Frameworks
// RUN: mkdir -p %t/Frameworks/E.framework/
// RUN: mkdir -p %t/Frameworks/E.framework/Modules
// RUN: mkdir -p %t/Frameworks/E.framework/Modules/E.swiftmodule
// Copy over the interface
// RUN: cp %S/Inputs/Swift/E.swiftinterface %t/Frameworks/E.framework/Modules/E.swiftmodule/%module-target-triple.swiftinterface
// Run the scan
// RUN: %target-swift-frontend -scan-dependencies -enable-ossa-modules -disable-implicit-swift-modules -module-load-mode prefer-interface %s -o %t/deps.json -F %t/Frameworks/ -sdk %t
// RUN: %validate-json %t/deps.json | %FileCheck %s
import E
// CHECK: E.swiftmodule/{{.*}}.swiftinterface
// CHECK: "commandLine": [
// CHECK: "-enable-ossa-modules"
// CHECK: ]

View File

@@ -1,5 +1,5 @@
// RUN: %empty-directory(%t) // RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module -O -module-name Swift -module-link-name swiftCore -parse-as-library -parse-stdlib -emit-module %s -o %t/Swift.swiftmodule -enable-ossa-modules // RUN: %target-swift-frontend -emit-module -O -module-name Swift -module-link-name swiftCore -parse-as-library -parse-stdlib -emit-module %s -o %t/Swift.swiftmodule
// RUN: %target-sil-opt -enable-sil-verify-all %t/Swift.swiftmodule -emit-sorted-sil -o - | %FileCheck %s // RUN: %target-sil-opt -enable-sil-verify-all %t/Swift.swiftmodule -emit-sorted-sil -o - | %FileCheck %s
// Test that early serialization works as expected: // Test that early serialization works as expected:

View File

@@ -6,7 +6,7 @@
// RUN: %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -enable-experimental-feature Embedded -wmo // RUN: %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -enable-experimental-feature Embedded -wmo
// MyModule is not embedded - error // MyModule is not embedded - error
// RUN: %target-swift-frontend -emit-module -enable-ossa-modules -o %t/MyModule.swiftmodule %t/MyModule.swift -parse-stdlib -wmo // RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -parse-stdlib -wmo
// RUN: not %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -enable-experimental-feature Embedded -wmo 2>&1 | %FileCheck %s --check-prefix CHECK-A // RUN: not %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -enable-experimental-feature Embedded -wmo 2>&1 | %FileCheck %s --check-prefix CHECK-A
// main module is not embedded - error // main module is not embedded - error

View File

@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -enable-ossa-modules -o /dev/null | %target-sil-func-extractor -module-name="Swift" -enable-ossa-modules -func='$ss1XV4testyyF' | %FileCheck %s // RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -o /dev/null | %target-sil-func-extractor -module-name="Swift" -func='$ss1XV4testyyF' | %FileCheck %s
// RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -enable-ossa-modules -o - | %target-sil-func-extractor -module-name="Swift" -enable-ossa-modules -func='$ss1XV4testyyF' | %FileCheck %s -check-prefix=SIB-CHECK // RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -o - | %target-sil-func-extractor -module-name="Swift" -func='$ss1XV4testyyF' | %FileCheck %s -check-prefix=SIB-CHECK
// CHECK: import Builtin // CHECK: import Builtin
// CHECK: import Swift // CHECK: import Swift

View File

@@ -1,5 +1,5 @@
// RUN: %target-swift-frontend -primary-file %s -enable-ossa-modules -module-name Swift -g -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -o /dev/null | %target-sil-opt -enable-sil-verify-all -module-name="Swift" -emit-sorted-sil | %FileCheck %s // RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -module-link-name swiftCore -O -parse-as-library -parse-stdlib -emit-module -emit-module-path - -o /dev/null | %target-sil-opt -enable-sil-verify-all -module-name="Swift" -emit-sorted-sil | %FileCheck %s
// RUN: %target-swift-frontend -primary-file %s -enable-ossa-modules -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -o - | %target-sil-opt -enable-sil-verify-all -module-name="Swift" -emit-sorted-sil | %FileCheck %s -check-prefix=SIB-CHECK // RUN: %target-swift-frontend -primary-file %s -module-name Swift -g -O -parse-as-library -parse-stdlib -emit-sib -o - | %target-sil-opt -enable-sil-verify-all -module-name="Swift" -emit-sorted-sil | %FileCheck %s -check-prefix=SIB-CHECK
// CHECK: import Builtin // CHECK: import Builtin
// CHECK: import Swift // CHECK: import Swift

View File

@@ -46,12 +46,12 @@ void anchorForGetMainExecutable() {}
using namespace llvm::MachO; using namespace llvm::MachO;
static bool validateModule( static bool validateModule(
llvm::StringRef data, bool Verbose, bool requiresOSSAModules, llvm::StringRef data, bool Verbose,
swift::serialization::ValidationInfo &info, swift::serialization::ValidationInfo &info,
swift::serialization::ExtendedValidationInfo &extendedInfo, swift::serialization::ExtendedValidationInfo &extendedInfo,
llvm::SmallVectorImpl<swift::serialization::SearchPath> &searchPaths) { llvm::SmallVectorImpl<swift::serialization::SearchPath> &searchPaths) {
info = swift::serialization::validateSerializedAST( info = swift::serialization::validateSerializedAST(
data, requiresOSSAModules, data,
/*requiredSDK*/ StringRef(), &extendedInfo, /* dependencies*/ nullptr, /*requiredSDK*/ StringRef(), &extendedInfo, /* dependencies*/ nullptr,
&searchPaths); &searchPaths);
if (info.status != swift::serialization::Status::Valid) { if (info.status != swift::serialization::Status::Valid) {
@@ -284,9 +284,6 @@ int main(int argc, char **argv) {
opt<bool> QualifyTypes("qualify-types", desc("Qualify dumped types"), opt<bool> QualifyTypes("qualify-types", desc("Qualify dumped types"),
cat(Visible)); cat(Visible));
opt<bool> EnableOSSAModules("enable-ossa-modules", init(false),
desc("Serialize modules in OSSA"), cat(Visible));
ParseCommandLineOptions(argc, argv); ParseCommandLineOptions(argc, argv);
// Unregister our options so they don't interfere with the command line // Unregister our options so they don't interfere with the command line
@@ -331,7 +328,6 @@ int main(int argc, char **argv) {
info = {}; info = {};
extendedInfo = {}; extendedInfo = {};
if (!validateModule(StringRef(Module.first, Module.second), Verbose, if (!validateModule(StringRef(Module.first, Module.second), Verbose,
EnableOSSAModules,
info, extendedInfo, searchPaths)) { info, extendedInfo, searchPaths)) {
llvm::errs() << "Malformed module!\n"; llvm::errs() << "Malformed module!\n";
return 1; return 1;
@@ -355,7 +351,6 @@ int main(int argc, char **argv) {
Invocation.setModuleName("lldbtest"); Invocation.setModuleName("lldbtest");
Invocation.getClangImporterOptions().ModuleCachePath = ModuleCachePath; Invocation.getClangImporterOptions().ModuleCachePath = ModuleCachePath;
Invocation.getLangOptions().EnableMemoryBufferImporter = true; Invocation.getLangOptions().EnableMemoryBufferImporter = true;
Invocation.getSILOptions().EnableOSSAModules = EnableOSSAModules;
if (!ResourceDir.empty()) { if (!ResourceDir.empty()) {
Invocation.setRuntimeResourcePath(ResourceDir); Invocation.setRuntimeResourcePath(ResourceDir);

View File

@@ -111,8 +111,7 @@ protected:
ctx->addModuleInterfaceChecker( ctx->addModuleInterfaceChecker(
std::make_unique<ModuleInterfaceCheckerImpl>(*ctx, cacheDir, std::make_unique<ModuleInterfaceCheckerImpl>(*ctx, cacheDir,
prebuiltCacheDir, ModuleInterfaceLoaderOptions(), prebuiltCacheDir, ModuleInterfaceLoaderOptions()));
swift::RequireOSSAModules_t(silOpts)));
auto loader = ModuleInterfaceLoader::create( auto loader = ModuleInterfaceLoader::create(
*ctx, *static_cast<ModuleInterfaceCheckerImpl*>( *ctx, *static_cast<ModuleInterfaceCheckerImpl*>(
@@ -152,7 +151,7 @@ protected:
auto bufData = (*bufOrErr)->getBuffer(); auto bufData = (*bufOrErr)->getBuffer();
auto validationInfo = serialization::validateSerializedAST( auto validationInfo = serialization::validateSerializedAST(
bufData, silOpts.EnableOSSAModules, bufData,
/*requiredSDK*/StringRef()); /*requiredSDK*/StringRef());
ASSERT_EQ(serialization::Status::Valid, validationInfo.status); ASSERT_EQ(serialization::Status::Valid, validationInfo.status);
ASSERT_EQ(bufData, moduleBuffer->getBuffer()); ASSERT_EQ(bufData, moduleBuffer->getBuffer());