diff --git a/Runtimes/Core/CMakeLists.txt b/Runtimes/Core/CMakeLists.txt index ff1b35cd93e..1ffa2809b03 100644 --- a/Runtimes/Core/CMakeLists.txt +++ b/Runtimes/Core/CMakeLists.txt @@ -194,7 +194,6 @@ add_compile_options( "$<$:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>" "$<$:-no-link-objc-runtime>" "$<$:SHELL:-Xfrontend -enforce-exclusivity=unchecked>" - "$<$:SHELL:-Xfrontend -enable-ossa-modules>" "$<$:SHELL:-Xfrontend -empty-abi-descriptor>" "$<$:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>" "$<$>,$>:SHELL:-Xfrontend -disable-objc-interop>" diff --git a/Runtimes/Overlay/CMakeLists.txt b/Runtimes/Overlay/CMakeLists.txt index 5f60cff85ed..3a22cafd43b 100644 --- a/Runtimes/Overlay/CMakeLists.txt +++ b/Runtimes/Overlay/CMakeLists.txt @@ -71,7 +71,6 @@ add_compile_options( "$<$:SHELL:-Xfrontend -disable-implicit-concurrency-module-import>" "$<$:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>" "$<$:SHELL:-Xfrontend -enforce-exclusivity=unchecked>" - "$<$:SHELL:-Xfrontend -enable-ossa-modules>" "$<$:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>" "$<$,$>:-enable-library-evolution>" "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") diff --git a/Runtimes/Supplemental/Observation/CMakeLists.txt b/Runtimes/Supplemental/Observation/CMakeLists.txt index 59434af5254..af672af6968 100644 --- a/Runtimes/Supplemental/Observation/CMakeLists.txt +++ b/Runtimes/Supplemental/Observation/CMakeLists.txt @@ -81,7 +81,6 @@ add_compile_options( "$<$:SHELL:-enable-experimental-feature Macros>" "$<$:SHELL:-enable-experimental-feature ExtensionMacros>" "$<$:SHELL:-Xfrontend -enable-lexical-lifetimes=false>" - "$<$:SHELL:-Xfrontend -enable-ossa-modules>" "$<$:-warn-implicit-overrides>" "$<$,$>:-enable-library-evolution>" "$<$,$>:SHELL:-Xfrontend -prespecialize-generic-metadata>") diff --git a/include/swift/AST/SILOptions.h b/include/swift/AST/SILOptions.h index f7391c5916d..0d365e66fde 100644 --- a/include/swift/AST/SILOptions.h +++ b/include/swift/AST/SILOptions.h @@ -45,13 +45,12 @@ enum class CopyPropagationOption : uint8_t { // Do not add any copy propagation passes. Off = 0, - // Only add the copy propagation passes requested by other flags, currently - // just -enable-ossa-modules. + // Only add the copy propagation passes requested by other flags. RequestedPassesOnly, // 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. Optimizing, @@ -189,11 +188,6 @@ public: /// and go from OSSA to non-ownership SIL. 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 /// from another OSSA module. bool EnableRecompilationToOSSAModule = false; diff --git a/include/swift/Frontend/ModuleInterfaceLoader.h b/include/swift/Frontend/ModuleInterfaceLoader.h index 50661110b2c..ad38919e565 100644 --- a/include/swift/Frontend/ModuleInterfaceLoader.h +++ b/include/swift/Frontend/ModuleInterfaceLoader.h @@ -478,25 +478,6 @@ public: 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 { friend class ModuleInterfaceLoader; ASTContext &Ctx; @@ -504,23 +485,20 @@ class ModuleInterfaceCheckerImpl: public ModuleInterfaceChecker { std::string PrebuiltCacheDir; std::string BackupInterfaceDir; ModuleInterfaceLoaderOptions Opts; - RequireOSSAModules_t RequiresOSSAModules; public: explicit ModuleInterfaceCheckerImpl(ASTContext &Ctx, StringRef cacheDir, StringRef prebuiltCacheDir, StringRef BackupInterfaceDir, - ModuleInterfaceLoaderOptions opts, - RequireOSSAModules_t requiresOSSAModules) + ModuleInterfaceLoaderOptions opts) : Ctx(Ctx), CacheDir(cacheDir), PrebuiltCacheDir(prebuiltCacheDir), BackupInterfaceDir(BackupInterfaceDir), - Opts(opts), RequiresOSSAModules(requiresOSSAModules) {} + Opts(opts) {} explicit ModuleInterfaceCheckerImpl(ASTContext &Ctx, StringRef cacheDir, StringRef prebuiltCacheDir, - ModuleInterfaceLoaderOptions opts, - RequireOSSAModules_t requiresOSSAModules): + ModuleInterfaceLoaderOptions opts): ModuleInterfaceCheckerImpl(Ctx, cacheDir, prebuiltCacheDir, StringRef(), - opts, requiresOSSAModules) {} + opts) {} std::vector getCompiledModuleCandidatesForInterface(StringRef moduleName, StringRef interfacePath) override; @@ -596,7 +574,6 @@ public: ArrayRef> replayPrefixMap, bool SerializeDependencyHashes, bool TrackSystemDependencies, ModuleInterfaceLoaderOptions Opts, - RequireOSSAModules_t RequireOSSAModules, bool silenceInterfaceDiagnostics); /// Unconditionally build \p InPath (a swiftinterface file) to \p OutPath (as @@ -666,8 +643,7 @@ private: const LangOptions &LangOpts, const ClangImporterOptions &clangImporterOpts, const CASOptions &casOpts, - bool suppressRemarks, - RequireOSSAModules_t requireOSSAModules); + bool suppressRemarks); bool extractSwiftInterfaceVersionAndArgs(CompilerInvocation &subInvocation, DiagnosticEngine &subInstanceDiags, SwiftInterfaceInfo &interfaceInfo, @@ -684,7 +660,7 @@ public: StringRef backupModuleInterfaceDir, ArrayRef> replayPrefixMap, bool serializeDependencyHashes, - bool trackSystemDependencies, RequireOSSAModules_t requireOSSAModules); + bool trackSystemDependencies); template static InFlightDiagnostic diagnose(StringRef interfacePath, diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td index 3c84466b79c..3d034ee4526 100644 --- a/include/swift/Option/FrontendOptions.td +++ b/include/swift/Option/FrontendOptions.td @@ -1320,8 +1320,7 @@ def disable_ast_verifier : Flag<["-"], "disable-ast-verifier">, let Flags = [FrontendOption, NoDriverOption, HelpHidden, ModuleInterfaceOptionIgnorable] in { def enable_ossa_modules : Flag<["-"], "enable-ossa-modules">, - HelpText<"Always serialize SIL in ossa form. If this flag is not passed in, " - "when optimizing ownership will be lowered before serializing SIL">; + HelpText<"Obsolete. This option is ignored">; } def enable_recompilation_to_ossa_module : Flag<["-"], "enable-recompilation-to-ossa-module">, diff --git a/include/swift/Serialization/SerializedModuleLoader.h b/include/swift/Serialization/SerializedModuleLoader.h index 25437af3e98..c137370177b 100644 --- a/include/swift/Serialization/SerializedModuleLoader.h +++ b/include/swift/Serialization/SerializedModuleLoader.h @@ -193,7 +193,6 @@ protected: static llvm::ErrorOr> getMatchingPackageOnlyImportsOfModule(Twine modulePath, bool isFramework, - bool isRequiredOSSAModules, StringRef SDKName, const llvm::Triple &target, StringRef packageName, @@ -222,8 +221,6 @@ public: std::unique_ptr moduleSourceInfoInputBuffer, bool isFramework); - bool isRequiredOSSAModules() const; - /// Check whether the module with a given name can be imported without /// importing it. /// diff --git a/include/swift/Serialization/Validation.h b/include/swift/Serialization/Validation.h index 33d773d9cef..455f0b55781 100644 --- a/include/swift/Serialization/Validation.h +++ b/include/swift/Serialization/Validation.h @@ -297,8 +297,6 @@ struct SearchPath { /// /// \param data A buffer containing the serialized AST. Result information /// 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 /// a compatible SDK. The StringRef represents the canonical SDK name. /// \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 /// input files the module depends on, if present in INPUT_BLOCK. ValidationInfo validateSerializedAST( - StringRef data, bool requiresOSSAModules, + StringRef data, StringRef requiredSDK, ExtendedValidationInfo *extendedInfo = nullptr, SmallVectorImpl *dependencies = diff --git a/lib/ASTSectionImporter/ASTSectionImporter.cpp b/lib/ASTSectionImporter/ASTSectionImporter.cpp index b41852496c8..1384630b739 100644 --- a/lib/ASTSectionImporter/ASTSectionImporter.cpp +++ b/lib/ASTSectionImporter/ASTSectionImporter.cpp @@ -58,7 +58,7 @@ swift::parseASTSection(MemoryBufferSerializedModuleLoader &Loader, // headers. Iterate over all AST modules. while (!buf.empty()) { auto info = serialization::validateSerializedAST( - buf, Loader.isRequiredOSSAModules(), + buf, /*requiredSDK*/StringRef()); assert(info.name.size() < (2 << 10) && "name failed sanity check"); diff --git a/lib/DependencyScan/ModuleDependencyScanner.cpp b/lib/DependencyScan/ModuleDependencyScanner.cpp index d5003db6e2c..0db8bc41eb6 100644 --- a/lib/DependencyScan/ModuleDependencyScanner.cpp +++ b/lib/DependencyScan/ModuleDependencyScanner.cpp @@ -252,8 +252,8 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker( workerCompilerInvocation->getFrontendOptions() .SerializeModuleInterfaceDependencyHashes, workerCompilerInvocation->getFrontendOptions() - .shouldTrackSystemDependencies(), - RequireOSSAModules_t(SILOptions)); + .shouldTrackSystemDependencies() + ); auto loader = std::make_unique( *workerASTContext, /*DepTracker=*/nullptr, diff --git a/lib/DriverTool/sil_func_extractor_main.cpp b/lib/DriverTool/sil_func_extractor_main.cpp index 9ff267001ab..b71ca4a809a 100644 --- a/lib/DriverTool/sil_func_extractor_main.cpp +++ b/lib/DriverTool/sil_func_extractor_main.cpp @@ -118,12 +118,6 @@ struct SILFuncExtractorOptions { llvm::cl::init(false), llvm::cl::desc("Do not dump AST.")); - llvm::cl::opt EnableOSSAModules = llvm::cl::opt( - "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 EnableObjCInterop = llvm::cl::opt( "enable-objc-interop", @@ -275,7 +269,6 @@ int sil_func_extractor_main(ArrayRef argv, void *MainAddr) { SILOptions &Opts = Invocation.getSILOptions(); Opts.EmitVerboseSIL = options.EmitVerboseSIL; Opts.EmitSortedSIL = options.EmitSortedSIL; - Opts.EnableOSSAModules = options.EnableOSSAModules; Opts.StopOptimizationAfterSerialization |= options.EmitSIB; serialization::ExtendedValidationInfo extendedInfo; @@ -368,7 +361,7 @@ int sil_func_extractor_main(ArrayRef argv, void *MainAddr) { serializationOpts.OutputPath = OutputFile; serializationOpts.SerializeAllSIL = true; serializationOpts.IsSIB = true; - serializationOpts.IsOSSA = options.EnableOSSAModules; + serializationOpts.IsOSSA = true; symbolgraphgen::SymbolGraphOptions symbolGraphOpts; diff --git a/lib/DriverTool/sil_opt_main.cpp b/lib/DriverTool/sil_opt_main.cpp index 86be1cc01d2..f4dd4ab8fca 100644 --- a/lib/DriverTool/sil_opt_main.cpp +++ b/lib/DriverTool/sil_opt_main.cpp @@ -316,12 +316,6 @@ struct SILOptOptions { EnableMoveInoutStackProtection = llvm::cl::opt("enable-move-inout-stack-protector", llvm::cl::desc("Enable the stack protector by moving values to temporaries.")); - llvm::cl::opt EnableOSSAModules = llvm::cl::opt( - "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 EnforceExclusivity = cl::opt( "enforce-exclusivity", cl::desc("Enforce law of exclusivity " @@ -902,7 +896,6 @@ int sil_opt_main(ArrayRef argv, void *MainAddr) { SILOpts.EnableThrowsPrediction = options.EnableThrowsPrediction; SILOpts.EnableNoReturnCold = options.EnableNoReturnCold; SILOpts.IgnoreAlwaysInline = options.IgnoreAlwaysInline; - SILOpts.EnableOSSAModules = options.EnableOSSAModules; SILOpts.EnableSILOpaqueValues = options.EnableSILOpaqueValues; SILOpts.OSSACompleteLifetimes = options.EnableOSSACompleteLifetimes; SILOpts.OSSAVerifyComplete = options.EnableOSSAVerifyComplete; @@ -1088,7 +1081,7 @@ int sil_opt_main(ArrayRef argv, void *MainAddr) { serializationOpts.OutputPath = OutputFile; serializationOpts.SerializeAllSIL = options.EmitSIB; serializationOpts.IsSIB = options.EmitSIB; - serializationOpts.IsOSSA = SILOpts.EnableOSSAModules; + serializationOpts.IsOSSA = true; symbolgraphgen::SymbolGraphOptions symbolGraphOptions; diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 390350621a4..6f1784ae6b2 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -3047,7 +3047,6 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args, enablePackMetadataStackPromotionFlag.value(); Opts.EnableARCOptimizations &= !Args.hasArg(OPT_disable_arc_opts); - Opts.EnableOSSAModules |= Args.hasArg(OPT_enable_ossa_modules); Opts.EnableRecompilationToOSSAModule |= Args.hasArg(OPT_enable_recompilation_to_ossa_module); Opts.EnableOSSAOptimizations &= !Args.hasArg(OPT_disable_ossa_opts); @@ -4190,8 +4189,6 @@ bool CompilerInvocation::parseArgs( SILOpts.CMOMode = CrossModuleOptimizationMode::Everything; SILOpts.EmbeddedSwift = true; SILOpts.UseAggressiveReg2MemForCodeSize = true; - // OSSA modules are required for deinit de-virtualization. - SILOpts.EnableOSSAModules = true; // -g is promoted to -gdwarf-types in embedded Swift if (IRGenOpts.DebugInfoLevel == IRGenDebugInfoLevel::ASTTypes) { IRGenOpts.DebugInfoLevel = IRGenDebugInfoLevel::DwarfTypes; @@ -4244,7 +4241,6 @@ CompilerInvocation::loadFromSerializedAST(StringRef data) { serialization::ValidationInfo info = serialization::validateSerializedAST( data, - getSILOptions().EnableOSSAModules, LangOpts.SDKName, &extendedInfo); @@ -4282,7 +4278,6 @@ CompilerInvocation::setUpInputForSILTool( auto result = serialization::validateSerializedAST( fileBufOrErr.get()->getBuffer(), - getSILOptions().EnableOSSAModules, LangOpts.SDKName, &extendedInfo); bool hasSerializedAST = result.status == serialization::Status::Valid; diff --git a/lib/Frontend/Frontend.cpp b/lib/Frontend/Frontend.cpp index d9c14324ff0..abb80c7d0c3 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -281,7 +281,7 @@ SerializationOptions CompilerInvocation::computeSerializationOptions( serializationOpts.SerializeDebugInfoSIL = true; } - serializationOpts.IsOSSA = getSILOptions().EnableOSSAModules; + serializationOpts.IsOSSA = true; serializationOpts.SkipNonExportableDecls = getLangOptions().SkipNonExportableDecls; @@ -792,8 +792,7 @@ bool CompilerInstance::setUpModuleLoaders() { Context->addModuleInterfaceChecker( std::make_unique( *Context, ModuleCachePathFromInvocation, FEOpts.PrebuiltModuleCachePath, - FEOpts.BackupModuleInterfaceDir, LoaderOpts, - RequireOSSAModules_t(Invocation.getSILOptions()))); + FEOpts.BackupModuleInterfaceDir, LoaderOpts)); if (MLM != ModuleLoadingMode::OnlySerialized) { // We only need ModuleInterfaceLoader for implicit modules. @@ -867,8 +866,7 @@ bool CompilerInstance::setUpModuleLoaders() { Context->addModuleInterfaceChecker( std::make_unique( *Context, ModuleCachePath, FEOpts.PrebuiltModuleCachePath, - FEOpts.BackupModuleInterfaceDir, LoaderOpts, - RequireOSSAModules_t(Invocation.getSILOptions()))); + FEOpts.BackupModuleInterfaceDir, LoaderOpts)); // Install an explicit module loader if it was created earlier. if (ESML) { @@ -910,8 +908,7 @@ bool CompilerInstance::setUpModuleLoaders() { FEOpts.PrebuiltModuleCachePath, FEOpts.BackupModuleInterfaceDir, FEOpts.CacheReplayPrefixMap, FEOpts.SerializeModuleInterfaceDependencyHashes, - FEOpts.shouldTrackSystemDependencies(), - RequireOSSAModules_t(Invocation.getSILOptions())); + FEOpts.shouldTrackSystemDependencies()); } return false; diff --git a/lib/Frontend/ModuleInterfaceBuilder.cpp b/lib/Frontend/ModuleInterfaceBuilder.cpp index be3dd3520cf..8a9e66054fd 100644 --- a/lib/Frontend/ModuleInterfaceBuilder.cpp +++ b/lib/Frontend/ModuleInterfaceBuilder.cpp @@ -310,7 +310,7 @@ std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface( return std::make_error_code(std::errc::not_supported); SerializationOpts.Dependencies = Deps; } - SerializationOpts.IsOSSA = SILOpts.EnableOSSAModules; + SerializationOpts.IsOSSA = true; SILMod->setSerializeSILAction([&]() { // We don't want to serialize module docs in the cache -- they diff --git a/lib/Frontend/ModuleInterfaceLoader.cpp b/lib/Frontend/ModuleInterfaceLoader.cpp index fade5b2bf48..0902ea421ba 100644 --- a/lib/Frontend/ModuleInterfaceLoader.cpp +++ b/lib/Frontend/ModuleInterfaceLoader.cpp @@ -213,10 +213,8 @@ public: namespace path = llvm::sys::path; static bool serializedASTLooksValid(const llvm::MemoryBuffer &buf, - bool requiresOSSAModules, StringRef requiredSDK) { auto VI = serialization::validateSerializedAST(buf.getBuffer(), - requiresOSSAModules, requiredSDK); return VI.status == serialization::Status::Valid; } @@ -408,14 +406,11 @@ StringRef getFullDependencyPath(const FileDependency &dep, class UpToDateModuleCheker { ASTContext &ctx; llvm::vfs::FileSystem &fs; - RequireOSSAModules_t requiresOSSAModules; public: - UpToDateModuleCheker(ASTContext &ctx, - RequireOSSAModules_t requiresOSSAModules) + UpToDateModuleCheker(ASTContext &ctx) : ctx(ctx), - fs(*ctx.SourceMgr.getFileSystem()), - requiresOSSAModules(requiresOSSAModules) {} + fs(*ctx.SourceMgr.getFileSystem()) {} // Check if all the provided file dependencies are up-to-date compared to // what's currently on disk. @@ -460,7 +455,7 @@ public: LLVM_DEBUG(llvm::dbgs() << "Validating deps of " << path << "\n"); auto validationInfo = serialization::validateSerializedAST( - buf.getBuffer(), requiresOSSAModules, + buf.getBuffer(), ctx.LangOpts.SDKName, /*ExtendedValidationInfo=*/nullptr, &allDeps); if (validationInfo.status != serialization::Status::Valid) { @@ -551,25 +546,22 @@ class ModuleInterfaceLoaderImpl { DependencyTracker *const dependencyTracker; const ModuleLoadingMode loadMode; ModuleInterfaceLoaderOptions Opts; - RequireOSSAModules_t requiresOSSAModules; ModuleInterfaceLoaderImpl( ASTContext &ctx, StringRef modulePath, StringRef interfacePath, StringRef moduleName, StringRef cacheDir, StringRef prebuiltCacheDir, StringRef backupInterfaceDir, SourceLoc diagLoc, ModuleInterfaceLoaderOptions Opts, - RequireOSSAModules_t requiresOSSAModules, DependencyTracker *dependencyTracker = nullptr, ModuleLoadingMode loadMode = ModuleLoadingMode::PreferSerialized) : ctx(ctx), fs(*ctx.SourceMgr.getFileSystem()), diags(ctx.Diags), - upToDateChecker(ctx, requiresOSSAModules), + upToDateChecker(ctx), modulePath(modulePath), interfacePath(interfacePath), moduleName(moduleName), prebuiltCacheDir(prebuiltCacheDir), backupInterfaceDir(backupInterfaceDir), cacheDir(cacheDir), diagnosticLoc(diagLoc), - dependencyTracker(dependencyTracker), loadMode(loadMode), Opts(Opts), - requiresOSSAModules(requiresOSSAModules) {} + dependencyTracker(dependencyTracker), loadMode(loadMode), Opts(Opts) {} std::string getBackupPublicModuleInterfacePath() { return getBackupPublicModuleInterfacePath(ctx.SourceMgr, backupInterfaceDir, @@ -622,7 +614,6 @@ class ModuleInterfaceLoaderImpl { return false; auto looksValid = serializedASTLooksValid(*modBuf.get(), - requiresOSSAModules, ctx.LangOpts.SDKName); if (!looksValid) return false; @@ -935,15 +926,7 @@ class ModuleInterfaceLoaderImpl { version::getCurrentCompilerSerializationTag().empty() && rebuildInfo.getOrInsertCandidateModule(adjacentMod) .serializationStatus != - 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) { + serialization::Status::SDKMismatch) { // Special-case here: If we're loading a .swiftmodule from the resource // dir adjacent to the compiler, defer to the serialized loader instead // of falling back. This is to support local development of Swift, @@ -1130,8 +1113,7 @@ class ModuleInterfaceLoaderImpl { ctx.ClangImporterOpts, ctx.CASOpts, Opts, /*buildModuleCacheDirIfAbsent*/ true, cacheDir, prebuiltCacheDir, backupInterfaceDir, /*replayPrefixMap=*/{}, - /*serializeDependencyHashes*/ false, trackSystemDependencies, - requiresOSSAModules); + /*serializeDependencyHashes*/ false, trackSystemDependencies); // Compute the output path if we're loading or emitting a cached module. SwiftInterfaceModuleOutputPathResolution::ResultTy resolvedOutputPath; @@ -1375,7 +1357,6 @@ std::error_code ModuleInterfaceLoader::findModuleFilesInDirectory( Ctx, ModPath, *InPath, ModuleName, InterfaceChecker.CacheDir, InterfaceChecker.PrebuiltCacheDir, InterfaceChecker.BackupInterfaceDir, ModuleID.Loc, InterfaceChecker.Opts, - InterfaceChecker.RequiresOSSAModules, dependencyTracker, llvm::is_contained(PreferInterfaceForModules, ModuleName) ? ModuleLoadingMode::PreferInterface @@ -1429,7 +1410,7 @@ ModuleInterfaceCheckerImpl::getCompiledModuleCandidatesForInterface( ModuleInterfaceLoaderImpl Impl(Ctx, modulePath, interfacePath, moduleName, CacheDir, PrebuiltCacheDir, BackupInterfaceDir, - SourceLoc(), Opts, RequiresOSSAModules, + SourceLoc(), Opts, nullptr, Ctx.SearchPathOpts.ModuleLoadMode); std::vector results; std::string adjacentMod, prebuiltMod; @@ -1469,7 +1450,6 @@ bool ModuleInterfaceCheckerImpl::tryEmitForwardingModule( ModuleInterfaceLoaderImpl Impl(Ctx, modulePath, interfacePath, moduleName, CacheDir, PrebuiltCacheDir, BackupInterfaceDir, SourceLoc(), Opts, - RequiresOSSAModules, nullptr, ModuleLoadingMode::PreferSerialized); SmallVector deps; @@ -1503,13 +1483,13 @@ bool ModuleInterfaceLoader::buildSwiftModuleFromSwiftInterface( ArrayRef> replayPrefixMap, bool SerializeDependencyHashes, bool TrackSystemDependencies, ModuleInterfaceLoaderOptions LoaderOpts, - RequireOSSAModules_t RequireOSSAModules, bool silenceInterfaceDiagnostics) { + bool silenceInterfaceDiagnostics) { InterfaceSubContextDelegateImpl astDelegate( SourceMgr, &Diags, SearchPathOpts, LangOpts, ClangOpts, CASOpts, LoaderOpts, /*CreateCacheDirIfAbsent*/ true, CacheDir, PrebuiltCacheDir, BackupInterfaceDir, replayPrefixMap, SerializeDependencyHashes, - TrackSystemDependencies, RequireOSSAModules); + TrackSystemDependencies); ImplicitModuleInterfaceBuilder builder(SourceMgr, &Diags, astDelegate, InPath, SearchPathOpts.getSDKPath(), 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 // exit. UpToDateModuleCheker checker( - Instance.getASTContext(), - RequireOSSAModules_t(Instance.getSILOptions())); + Instance.getASTContext()); ModuleRebuildInfo rebuildInfo; SmallVector allDeps; std::unique_ptr moduleBuffer; @@ -1684,7 +1663,7 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface( FrontendOptions::ActionType requestedAction, const SearchPathOptions &SearchPathOpts, const LangOptions &LangOpts, const ClangImporterOptions &clangImporterOpts, const CASOptions &casOpts, - bool suppressRemarks, RequireOSSAModules_t RequireOSSAModules) { + bool suppressRemarks) { GenericArgs.push_back("-frontend"); // Start with a genericSubInvocation that copies various state from our // invoking ASTContext. @@ -1791,12 +1770,6 @@ void InterfaceSubContextDelegateImpl::inheritOptionsForBuildingInterface( genericSubInvocation.getLangOptions().EnableObjCAttrRequiresFoundation = false; 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) { genericSubInvocation.getLangOptions().DisableAvailabilityChecking = true; GenericArgs.push_back("-disable-availability-checking"); @@ -1885,14 +1858,12 @@ InterfaceSubContextDelegateImpl::InterfaceSubContextDelegateImpl( StringRef moduleCachePath, StringRef prebuiltCachePath, StringRef backupModuleInterfaceDir, ArrayRef> replayPrefixMap, - bool serializeDependencyHashes, bool trackSystemDependencies, - RequireOSSAModules_t requireOSSAModules) + bool serializeDependencyHashes, bool trackSystemDependencies) : SM(SM), Diags(Diags), ArgSaver(Allocator) { genericSubInvocation.setMainExecutablePath(LoaderOpts.mainExecutablePath); inheritOptionsForBuildingInterface(LoaderOpts.requestedAction, searchPathOpts, langOpts, clangImporterOpts, casOpts, - Diags->getSuppressRemarks(), - requireOSSAModules); + Diags->getSuppressRemarks()); // Configure front-end input. auto &SubFEOpts = genericSubInvocation.getFrontendOptions(); SubFEOpts.RequestedAction = LoaderOpts.requestedAction; @@ -2447,7 +2418,6 @@ bool ExplicitSwiftModuleLoader::canImportModule( auto metaData = serialization::validateSerializedAST( (*moduleBuf)->getBuffer(), - Ctx.SILOpts.EnableOSSAModules, Ctx.LangOpts.SDKName); versionInfo->setVersion(metaData.userModuleVersion, ModuleVersionSourceKind::SwiftBinaryModule); @@ -2802,7 +2772,7 @@ bool ExplicitCASModuleLoader::canImportModule( return false; } auto metaData = serialization::validateSerializedAST( - moduleBuf->getBuffer(), Ctx.SILOpts.EnableOSSAModules, + moduleBuf->getBuffer(), Ctx.LangOpts.SDKName); versionInfo->setVersion(metaData.userModuleVersion, ModuleVersionSourceKind::SwiftBinaryModule); @@ -2915,12 +2885,6 @@ static std::string getContextHash(const CompilerInvocation &CI, // Application extension. 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? unsigned(CI.getLangOptions().EnableCXXInterop), diff --git a/lib/FrontendTool/FrontendTool.cpp b/lib/FrontendTool/FrontendTool.cpp index 7544562cfe3..ddf80e91e62 100644 --- a/lib/FrontendTool/FrontendTool.cpp +++ b/lib/FrontendTool/FrontendTool.cpp @@ -391,7 +391,7 @@ static bool buildModuleFromInterface(CompilerInstance &Instance) { Invocation.getOutputFilename(), ABIPath, FEOpts.CacheReplayPrefixMap, FEOpts.SerializeModuleInterfaceDependencyHashes, FEOpts.shouldTrackSystemDependencies(), LoaderOpts, - RequireOSSAModules_t(Invocation.getSILOptions()), IgnoreAdjacentModules); + IgnoreAdjacentModules); } static bool compileLLVMIR(CompilerInstance &Instance) { @@ -1754,7 +1754,7 @@ static bool serializeSIB(SILModule *SM, const PrimarySpecificPaths &PSPs, serializationOpts.OutputPath = moduleOutputPath; serializationOpts.SerializeAllSIL = true; serializationOpts.IsSIB = true; - serializationOpts.IsOSSA = Context.SILOpts.EnableOSSAModules; + serializationOpts.IsOSSA = true; symbolgraphgen::SymbolGraphOptions symbolGraphOptions; diff --git a/lib/SILOptimizer/PassManager/PassPipeline.cpp b/lib/SILOptimizer/PassManager/PassPipeline.cpp index e3787c74967..8913a46217d 100644 --- a/lib/SILOptimizer/PassManager/PassPipeline.cpp +++ b/lib/SILOptimizer/PassManager/PassPipeline.cpp @@ -543,16 +543,6 @@ void addFunctionPasses(SILPassPipelinePlan &P, P.addSemanticARCOpts(); P.addCopyToBorrowOptimization(); - if (!P.getOptions().EnableOSSAModules) { - if (P.getOptions().StopOptimizationBeforeLoweringOwnership) - return; - - if (SILPrintFinalOSSAModule) { - addModulePrinterPipeline(P, "SIL Print Final OSSA Module"); - } - P.addNonTransparentFunctionOwnershipModelEliminator(); - } - switch (OpLevel) { case OptimizationLevelKind::HighLevel: // 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. - if (P.getOptions().EnableOSSAModules) { - if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) { - P.addCopyPropagation(); - } - P.addSemanticARCOpts(); - P.addCopyToBorrowOptimization(); + if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) { + P.addCopyPropagation(); } + P.addSemanticARCOpts(); + P.addCopyToBorrowOptimization(); // Promote stack allocations to values and eliminate redundant // loads. @@ -633,14 +621,12 @@ void addFunctionPasses(SILPassPipelinePlan &P, P.addARCSequenceOpts(); // Run a final round of ARC opts when ownership is enabled. - if (P.getOptions().EnableOSSAModules) { - P.addDestroyHoisting(); - if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) { - P.addCopyPropagation(); - } - P.addSemanticARCOpts(); - P.addCopyToBorrowOptimization(); + P.addDestroyHoisting(); + if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) { + P.addCopyPropagation(); } + P.addSemanticARCOpts(); + P.addCopyToBorrowOptimization(); } 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 // lowering ownership. - if (P.getOptions().EnableOSSAModules) { - if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) { - P.addCopyPropagation(); - } - P.addSemanticARCOpts(); - P.addCopyToBorrowOptimization(); + if (P.getOptions().CopyPropagation != CopyPropagationOption::Off) { + P.addCopyPropagation(); } + P.addSemanticARCOpts(); + P.addCopyToBorrowOptimization(); P.addCrossModuleOptimization(); @@ -1042,10 +1026,9 @@ SILPassPipelinePlan::getPerformancePassPipeline(const SILOptions &Options) { if (Options.StopOptimizationAfterSerialization) return P; - if (P.getOptions().EnableOSSAModules && SILPrintFinalOSSAModule) { + if (SILPrintFinalOSSAModule) { addModulePrinterPipeline(P, "SIL Print Final OSSA Module"); } - // Strip any transparent functions that still have ownership. P.addOwnershipModelEliminator(); P.addAutodiffClosureSpecialization(); @@ -1126,7 +1109,6 @@ SILPassPipelinePlan::getOnonePassPipeline(const SILOptions &Options) { if (P.Options.StopOptimizationBeforeLoweringOwnership) return P; - // Now strip any transparent functions that still have ownership. P.addOwnershipModelEliminator(); // Finally perform some small transforms. diff --git a/lib/SILOptimizer/SILCombiner/SILCombine.cpp b/lib/SILOptimizer/SILCombiner/SILCombine.cpp index 1c6d9ba79cf..51eab585e27 100644 --- a/lib/SILOptimizer/SILCombiner/SILCombine.cpp +++ b/lib/SILOptimizer/SILCombiner/SILCombine.cpp @@ -669,10 +669,8 @@ class SILCombine : public SILFunctionTransform { void run() override { bool enableCopyPropagation = getOptions().CopyPropagation >= CopyPropagationOption::Optimizing; - if (getOptions().EnableOSSAModules) { - enableCopyPropagation = - getOptions().CopyPropagation != CopyPropagationOption::Off; - } + enableCopyPropagation = + getOptions().CopyPropagation != CopyPropagationOption::Off; SILCombiner Combiner(this, getOptions().RemoveRuntimeAsserts, enableCopyPropagation); diff --git a/lib/Serialization/ModuleFile.cpp b/lib/Serialization/ModuleFile.cpp index 3b8131199ed..e23a263c59b 100644 --- a/lib/Serialization/ModuleFile.cpp +++ b/lib/Serialization/ModuleFile.cpp @@ -426,7 +426,7 @@ ModuleFile::getModuleName(ASTContext &Ctx, StringRef modulePath, bool isFramework = false; serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( "", "", std::move(newBuf), nullptr, nullptr, - /*isFramework=*/isFramework, Ctx.SILOpts.EnableOSSAModules, + /*isFramework=*/isFramework, Ctx.LangOpts.SDKName, Ctx.LangOpts.Target, Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFile); Name = loadedModuleFile->Name.str(); diff --git a/lib/Serialization/ModuleFileSharedCore.cpp b/lib/Serialization/ModuleFileSharedCore.cpp index 11861d3262a..995aff51477 100644 --- a/lib/Serialization/ModuleFileSharedCore.cpp +++ b/lib/Serialization/ModuleFileSharedCore.cpp @@ -242,7 +242,6 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor, static ValidationInfo validateControlBlock( llvm::BitstreamCursor &cursor, SmallVectorImpl &scratch, std::pair expectedVersion, - bool requiresOSSAModules, bool requiresRevisionMatch, StringRef requiredSDK, std::optional target, @@ -486,7 +485,7 @@ static ValidationInfo validateControlBlock( } case control_block::IS_OSSA: { auto isModuleInOSSA = scratch[0]; - if (requiresOSSAModules && !isModuleInOSSA) + if (!isModuleInOSSA) result.status = Status::NotInOSSA; break; } @@ -615,7 +614,7 @@ bool serialization::isSerializedAST(StringRef data) { } ValidationInfo serialization::validateSerializedAST( - StringRef data, bool requiresOSSAModules, + StringRef data, StringRef requiredSDK, ExtendedValidationInfo *extendedInfo, SmallVectorImpl *dependencies, @@ -661,7 +660,6 @@ ValidationInfo serialization::validateSerializedAST( result = validateControlBlock( cursor, scratch, {SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR}, - requiresOSSAModules, /*requiresRevisionMatch=*/true, requiredSDK, target, extendedInfo, localObfuscator); @@ -1213,7 +1211,6 @@ bool ModuleFileSharedCore::readModuleDocIfPresent(PathObfuscator &pathRecoverer) info = validateControlBlock( docCursor, scratch, {SWIFTDOC_VERSION_MAJOR, SWIFTDOC_VERSION_MINOR}, - RequiresOSSAModules, /*requiresRevisionMatch*/false, /*requiredSDK*/StringRef(), /*target*/std::nullopt, /*extendedInfo*/nullptr, pathRecoverer); @@ -1359,7 +1356,6 @@ bool ModuleFileSharedCore::readModuleSourceInfoIfPresent(PathObfuscator &pathRec info = validateControlBlock( infoCursor, scratch, {SWIFTSOURCEINFO_VERSION_MAJOR, SWIFTSOURCEINFO_VERSION_MINOR}, - RequiresOSSAModules, /*requiresRevisionMatch*/false, /*requiredSDK*/StringRef(), /*target*/std::nullopt, /*extendedInfo*/nullptr, pathRecoverer); @@ -1439,14 +1435,12 @@ ModuleFileSharedCore::ModuleFileSharedCore( std::unique_ptr moduleDocInputBuffer, std::unique_ptr moduleSourceInfoInputBuffer, bool isFramework, - bool requiresOSSAModules, StringRef requiredSDK, std::optional target, serialization::ValidationInfo &info, PathObfuscator &pathRecoverer) : ModuleInputBuffer(std::move(moduleInputBuffer)), ModuleDocInputBuffer(std::move(moduleDocInputBuffer)), - ModuleSourceInfoInputBuffer(std::move(moduleSourceInfoInputBuffer)), - RequiresOSSAModules(requiresOSSAModules) { + ModuleSourceInfoInputBuffer(std::move(moduleSourceInfoInputBuffer)) { assert(!hasError()); Bits.IsFramework = isFramework; @@ -1493,7 +1487,6 @@ ModuleFileSharedCore::ModuleFileSharedCore( info = validateControlBlock( cursor, scratch, {SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR}, - RequiresOSSAModules, /*requiresRevisionMatch=*/true, requiredSDK, target, &extInfo, pathRecoverer); if (info.status != Status::Valid) { diff --git a/lib/Serialization/ModuleFileSharedCore.h b/lib/Serialization/ModuleFileSharedCore.h index 8d1c4db13fe..ca0a132e82b 100644 --- a/lib/Serialization/ModuleFileSharedCore.h +++ b/lib/Serialization/ModuleFileSharedCore.h @@ -114,9 +114,6 @@ class ModuleFileSharedCore { /// \c true if this module has incremental dependency information. 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. ArrayRef AllowableClientNames; @@ -445,7 +442,6 @@ private: std::unique_ptr moduleDocInputBuffer, std::unique_ptr moduleSourceInfoInputBuffer, bool isFramework, - bool requiresOSSAModules, StringRef requiredSDK, std::optional target, serialization::ValidationInfo &info, PathObfuscator &pathRecoverer); @@ -573,8 +569,6 @@ public: /// of the buffer, even if there's an error in loading. /// \param isFramework If true, this is treated as a framework module for /// 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, /// to ensure that the loaded module was built with a compatible SDK. /// \param target The target triple of the current compilation for @@ -587,7 +581,7 @@ public: std::unique_ptr moduleInputBuffer, std::unique_ptr moduleDocInputBuffer, std::unique_ptr moduleSourceInfoInputBuffer, - bool isFramework, bool requiresOSSAModules, + bool isFramework, StringRef requiredSDK, std::optional target, PathObfuscator &pathRecoverer, std::shared_ptr &theModule) { @@ -595,7 +589,7 @@ public: auto *core = new ModuleFileSharedCore( std::move(moduleInputBuffer), std::move(moduleDocInputBuffer), std::move(moduleSourceInfoInputBuffer), isFramework, - requiresOSSAModules, requiredSDK, target, info, + requiredSDK, target, info, pathRecoverer); if (!moduleInterfacePath.empty()) { ArrayRef path; diff --git a/lib/Serialization/ScanningLoaders.cpp b/lib/Serialization/ScanningLoaders.cpp index 9029739e263..a3f9f023d8b 100644 --- a/lib/Serialization/ScanningLoaders.cpp +++ b/lib/Serialization/ScanningLoaders.cpp @@ -252,7 +252,7 @@ SwiftModuleScanner::scanInterfaceFile(Identifier moduleID, if (adjacentBinaryModule != compiledCandidates.end()) { auto adjacentBinaryModulePackageOnlyImports = getMatchingPackageOnlyImportsOfModule( - *adjacentBinaryModule, isFramework, isRequiredOSSAModules(), + *adjacentBinaryModule, isFramework, Ctx.LangOpts.SDKName, Ctx.LangOpts.Target, ScannerPackageName, Ctx.SourceMgr.getFileSystem().get(), Ctx.SearchPathOpts.DeserializedPathRecoverer); @@ -294,7 +294,7 @@ llvm::ErrorOr SwiftModuleScanner::scanBinaryModuleFile( std::shared_ptr loadedModuleFile; serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( "", "", std::move(moduleBuf.get()), nullptr, nullptr, isFramework, - isRequiredOSSAModules(), Ctx.LangOpts.SDKName, Ctx.LangOpts.Target, + Ctx.LangOpts.SDKName, Ctx.LangOpts.Target, Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFile); if (Ctx.SearchPathOpts.ScannerModuleValidation) { diff --git a/lib/Serialization/SerializedModuleLoader.cpp b/lib/Serialization/SerializedModuleLoader.cpp index 07878cd69b8..86d925296de 100644 --- a/lib/Serialization/SerializedModuleLoader.cpp +++ b/lib/Serialization/SerializedModuleLoader.cpp @@ -343,7 +343,7 @@ std::optional SerializedModuleLoaderBase::invalidModuleReason(seria llvm::ErrorOr> SerializedModuleLoaderBase::getMatchingPackageOnlyImportsOfModule( - Twine modulePath, bool isFramework, bool isRequiredOSSAModules, + Twine modulePath, bool isFramework, StringRef SDKName, const llvm::Triple &target, StringRef packageName, llvm::vfs::FileSystem *fileSystem, PathObfuscator &recoverer) { auto moduleBuf = fileSystem->getBufferForFile(modulePath); @@ -355,7 +355,7 @@ SerializedModuleLoaderBase::getMatchingPackageOnlyImportsOfModule( std::shared_ptr loadedModuleFile; serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( "", "", std::move(moduleBuf.get()), nullptr, nullptr, isFramework, - isRequiredOSSAModules, SDKName, target, recoverer, loadedModuleFile); + SDKName, target, recoverer, loadedModuleFile); if (loadedModuleFile->getModulePackageName() != packageName) return importedModuleNames; @@ -953,7 +953,6 @@ LoadedFile *SerializedModuleLoaderBase::loadAST( moduleInterfacePath, moduleInterfaceSourcePath, std::move(moduleInputBuffer), std::move(moduleDocInputBuffer), std::move(moduleSourceInfoInputBuffer), isFramework, - isRequiredOSSAModules(), Ctx.LangOpts.SDKName, Ctx.LangOpts.Target, Ctx.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFileCore); SerializedASTFile *fileUnit = nullptr; @@ -1113,10 +1112,6 @@ LoadedFile *SerializedModuleLoaderBase::loadAST( return fileUnit; } -bool SerializedModuleLoaderBase::isRequiredOSSAModules() const { - return Ctx.SILOpts.EnableOSSAModules; -} - void swift::serialization::diagnoseSerializedASTLoadFailure( ASTContext &Ctx, SourceLoc diagLoc, const serialization::ValidationInfo &loadInfo, @@ -1155,12 +1150,9 @@ void swift::serialization::diagnoseSerializedASTLoadFailure( moduleBufferID); break; case serialization::Status::NotInOSSA: - if (Ctx.SerializationOpts.ExplicitModuleBuild || - Ctx.SILOpts.EnableOSSAModules) { - Ctx.Diags.diagnose(diagLoc, - diag::serialization_non_ossa_module_incompatible, - ModuleName); - } + Ctx.Diags.diagnose(diagLoc, + diag::serialization_non_ossa_module_incompatible, + ModuleName); break; case serialization::Status::RevisionIncompatible: Ctx.Diags.diagnose(diagLoc, diag::serialization_module_incompatible_revision, @@ -1498,7 +1490,7 @@ std::unique_ptr swift::extractEmbeddedBridgingHeaderContent( std::shared_ptr loadedModuleFile; serialization::ValidationInfo loadInfo = ModuleFileSharedCore::load( "", "", std::move(file), nullptr, nullptr, false, - Context.SILOpts.EnableOSSAModules, Context.LangOpts.SDKName, + Context.LangOpts.SDKName, Context.LangOpts.Target, Context.SearchPathOpts.DeserializedPathRecoverer, loadedModuleFile); @@ -1553,7 +1545,7 @@ bool SerializedModuleLoaderBase::canImportModule( if (moduleInputBuffer) { auto metaData = serialization::validateSerializedAST( - moduleInputBuffer->getBuffer(), Ctx.SILOpts.EnableOSSAModules, + moduleInputBuffer->getBuffer(), Ctx.LangOpts.SDKName); // If we only found binary module, make sure that is valid. diff --git a/stdlib/cmake/modules/AddSwiftStdlib.cmake b/stdlib/cmake/modules/AddSwiftStdlib.cmake index 825e414d346..e47c9db33ab 100644 --- a/stdlib/cmake/modules/AddSwiftStdlib.cmake +++ b/stdlib/cmake/modules/AddSwiftStdlib.cmake @@ -1920,9 +1920,6 @@ endfunction() # INSTALL_WITH_SHARED # Install a static library target alongside shared libraries # -# IMPORTS_NON_OSSA -# Imports a non-ossa module -# # MACCATALYST_BUILD_FLAVOR # Possible values are 'ios-like', 'macos-like', 'zippered', 'unzippered-twin' # Presence of a build flavor requires SWIFT_MODULE_DEPENDS_MACCATALYST to be @@ -1984,8 +1981,7 @@ function(add_swift_target_library name) SHARED STATIC NO_LINK_NAME - INSTALL_WITH_SHARED - IMPORTS_NON_OSSA) + INSTALL_WITH_SHARED) set(SWIFTLIB_single_parameter_options DEPLOYMENT_VERSION_IOS DEPLOYMENT_VERSION_OSX @@ -2150,10 +2146,6 @@ function(add_swift_target_library name) list(APPEND SWIFTLIB_SWIFT_COMPILE_FLAGS "-Xfrontend;-enable-lexical-lifetimes=false") 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) set(SWIFTLIB_INSTALL_BINARY_SWIFTMODULE TRUE) endif() diff --git a/stdlib/public/Distributed/CMakeLists.txt b/stdlib/public/Distributed/CMakeLists.txt index 2e4970c3e4e..9cef1492417 100644 --- a/stdlib/public/Distributed/CMakeLists.txt +++ b/stdlib/public/Distributed/CMakeLists.txt @@ -25,7 +25,7 @@ set(swift_distributed_link_libraries 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.swift DistributedActorSystem.swift diff --git a/stdlib/public/Synchronization/CMakeLists.txt b/stdlib/public/Synchronization/CMakeLists.txt index 357aef55469..7eeb1b4bc2a 100644 --- a/stdlib/public/Synchronization/CMakeLists.txt +++ b/stdlib/public/Synchronization/CMakeLists.txt @@ -96,7 +96,7 @@ set(SWIFT_SYNCHRNOIZATION_SWIFT_FLAGS "-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} GYB_SOURCES diff --git a/stdlib/public/core/CMakeLists.txt b/stdlib/public/core/CMakeLists.txt index 2c950345973..e596f6374ad 100644 --- a/stdlib/public/core/CMakeLists.txt +++ b/stdlib/public/core/CMakeLists.txt @@ -536,7 +536,6 @@ if(SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB) GYB_SOURCES ${SWIFTLIB_EMBEDDED_GYB_SOURCES} SWIFT_COMPILE_FLAGS ${swift_stdlib_compile_flags} -Xcc -ffreestanding -enable-experimental-feature Embedded - -Xfrontend -enable-ossa-modules MODULE_DIR "${CMAKE_BINARY_DIR}/lib/swift/embedded" SDK "embedded" ARCHITECTURE "${arch}" diff --git a/test/DebugInfo/optimizer_pipeline.swift b/test/DebugInfo/optimizer_pipeline.swift index 8071848bbd2..ed5ba13c890 100644 --- a/test/DebugInfo/optimizer_pipeline.swift +++ b/test/DebugInfo/optimizer_pipeline.swift @@ -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 diff --git a/test/Interpreter/moveonly_linkedlist.swift b/test/Interpreter/moveonly_linkedlist.swift index d3be7489ef4..b063400ef52 100644 --- a/test/Interpreter/moveonly_linkedlist.swift +++ b/test/Interpreter/moveonly_linkedlist.swift @@ -1,6 +1,5 @@ // 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 -Xfrontend -enable-ossa-modules) // REQUIRES: executable_test diff --git a/test/Interpreter/moveonly_linkedlist_2_simple.swift b/test/Interpreter/moveonly_linkedlist_2_simple.swift index 55f7d13d336..3dc1701c042 100644 --- a/test/Interpreter/moveonly_linkedlist_2_simple.swift +++ b/test/Interpreter/moveonly_linkedlist_2_simple.swift @@ -6,7 +6,6 @@ // 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(-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 diff --git a/test/ModuleInterface/ossa-modules/sdk-test-stdlib-ossa.swift b/test/ModuleInterface/ossa-modules/sdk-test-stdlib-ossa.swift index 41d380d50ee..29e2cb6b490 100644 --- a/test/ModuleInterface/ossa-modules/sdk-test-stdlib-ossa.swift +++ b/test/ModuleInterface/ossa-modules/sdk-test-stdlib-ossa.swift @@ -13,7 +13,7 @@ // RUN: %empty-directory(%t/SDK/usr/lib/swift/%relative-platform-module-dir-prefix/Swift.swiftmodule) // 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 @@ -23,7 +23,7 @@ // 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 // UNSUPPORTED: CPU=arm64, CPU=arm64e diff --git a/test/SIL/Serialization/shared_function_serialization.sil b/test/SIL/Serialization/shared_function_serialization.sil index 40c85f5a569..ad8fe95ac29 100644 --- a/test/SIL/Serialization/shared_function_serialization.sil +++ b/test/SIL/Serialization/shared_function_serialization.sil @@ -1,6 +1,6 @@ // 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-sil-opt -enable-sil-verify-all -I %t -performance-linker -enable-ossa-modules -inline %s -o - | %FileCheck %s +// 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 -inline %s -o - | %FileCheck %s // CHECK: sil private @top_level_code // CHECK: sil public_external [serialized] [ossa] @$ss1XVABycfC{{.*}} diff --git a/test/SILOptimizer/jumpthreadtest.swift b/test/SILOptimizer/jumpthreadtest.swift index e0adcd7a7d7..5c82d89e9fe 100644 --- a/test/SILOptimizer/jumpthreadtest.swift +++ b/test/SILOptimizer/jumpthreadtest.swift @@ -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 import Swift diff --git a/test/SILOptimizer/opaque_values_mandatory.sil b/test/SILOptimizer/opaque_values_mandatory.sil index 7a5128afc55..f30aec82a88 100644 --- a/test/SILOptimizer/opaque_values_mandatory.sil +++ b/test/SILOptimizer/opaque_values_mandatory.sil @@ -1,7 +1,7 @@ // RUN: %target-sil-opt -diagnostics -enable-sil-opaque-values %s | \ // RUN: %target-sil-opt -Onone-performance -enable-sil-verify-all \ // 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: %FileCheck %s // diff --git a/test/SILOptimizer/optimize_keypath_bug.swift b/test/SILOptimizer/optimize_keypath_bug.swift index 0ce95478c83..e4a23fe0663 100644 --- a/test/SILOptimizer/optimize_keypath_bug.swift +++ b/test/SILOptimizer/optimize_keypath_bug.swift @@ -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 import Foundation diff --git a/test/SILOptimizer/outliner.swift b/test/SILOptimizer/outliner.swift index 184f932f5ea..ccfdeebe099 100644 --- a/test/SILOptimizer/outliner.swift +++ b/test/SILOptimizer/outliner.swift @@ -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 -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: optimized_stdlib // REQUIRES: swift_in_compiler diff --git a/test/SILOptimizer/sil_combine1.swift b/test/SILOptimizer/sil_combine1.swift index 954edd7329d..aad1d654fa4 100644 --- a/test/SILOptimizer/sil_combine1.swift +++ b/test/SILOptimizer/sil_combine1.swift @@ -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 -enable-ossa-modules -emit-sil | %FileCheck %s func curry(_ f: @escaping (T1, T2, T3) -> T4) -> (T1) -> (T2) -> (T3) -> T4 { return { x in { y in { z in f(x, y, z) } } } diff --git a/test/SILOptimizer/sil_combine_apply_ossa.sil b/test/SILOptimizer/sil_combine_apply_ossa.sil index 5eac09217ba..dbaca018691 100644 --- a/test/SILOptimizer/sil_combine_apply_ossa.sil +++ b/test/SILOptimizer/sil_combine_apply_ossa.sil @@ -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 Builtin diff --git a/test/SILOptimizer/sil_combine_concrete_existential_ossa.swift b/test/SILOptimizer/sil_combine_concrete_existential_ossa.swift index 569d37514fb..8b55f020e08 100644 --- a/test/SILOptimizer/sil_combine_concrete_existential_ossa.swift +++ b/test/SILOptimizer/sil_combine_concrete_existential_ossa.swift @@ -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 -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 -sil-verify-all -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 diff --git a/test/SILOptimizer/simplify_cfg_crash.swift b/test/SILOptimizer/simplify_cfg_crash.swift index 5410b986f62..8deab725963 100644 --- a/test/SILOptimizer/simplify_cfg_crash.swift +++ b/test/SILOptimizer/simplify_cfg_crash.swift @@ -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 {} diff --git a/test/SILOptimizer/stdlib/Atomics.swift b/test/SILOptimizer/stdlib/Atomics.swift index 4b9bee2308e..43e3effecb2 100644 --- a/test/SILOptimizer/stdlib/Atomics.swift +++ b/test/SILOptimizer/stdlib/Atomics.swift @@ -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 diff --git a/test/SILOptimizer/string_optimization.swift b/test/SILOptimizer/string_optimization.swift index 676b2a36e61..410161abd79 100644 --- a/test/SILOptimizer/string_optimization.swift +++ b/test/SILOptimizer/string_optimization.swift @@ -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 -Xfrontend -enable-ossa-modules | %FileCheck %s // RUN: %empty-directory(%t) // RUN: %target-build-swift -O -module-name=test %s -o %t/a.out diff --git a/test/SILOptimizer/templvalueopt.swift b/test/SILOptimizer/templvalueopt.swift index 6c3a7c86a40..944b792f047 100644 --- a/test/SILOptimizer/templvalueopt.swift +++ b/test/SILOptimizer/templvalueopt.swift @@ -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: %target-build-swift -O -module-name=test %s -o %t/a.out diff --git a/test/ScanDependencies/enable-ossa-modules-pass-down.swift b/test/ScanDependencies/enable-ossa-modules-pass-down.swift deleted file mode 100644 index 030d2d17d84..00000000000 --- a/test/ScanDependencies/enable-ossa-modules-pass-down.swift +++ /dev/null @@ -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: ] diff --git a/test/Serialization/early-serialization.swift b/test/Serialization/early-serialization.swift index b8bb3d41d1f..d67ac946196 100644 --- a/test/Serialization/early-serialization.swift +++ b/test/Serialization/early-serialization.swift @@ -1,5 +1,5 @@ // 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 // Test that early serialization works as expected: diff --git a/test/embedded/basic-modules-validation-no-stdlib.swift b/test/embedded/basic-modules-validation-no-stdlib.swift index e37edf570ba..75009858388 100644 --- a/test/embedded/basic-modules-validation-no-stdlib.swift +++ b/test/embedded/basic-modules-validation-no-stdlib.swift @@ -6,7 +6,7 @@ // RUN: %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -enable-experimental-feature Embedded -wmo // 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 // main module is not embedded - error diff --git a/test/sil-func-extractor/load-serialized-sil.swift b/test/sil-func-extractor/load-serialized-sil.swift index 49ee238d3a0..2233e8cc199 100644 --- a/test/sil-func-extractor/load-serialized-sil.swift +++ b/test/sil-func-extractor/load-serialized-sil.swift @@ -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 -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 -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 -o - | %target-sil-func-extractor -module-name="Swift" -func='$ss1XV4testyyF' | %FileCheck %s -check-prefix=SIB-CHECK // CHECK: import Builtin // CHECK: import Swift diff --git a/test/sil-opt/sil-opt.swift b/test/sil-opt/sil-opt.swift index ac51333f47c..a51e9d32e62 100644 --- a/test/sil-opt/sil-opt.swift +++ b/test/sil-opt/sil-opt.swift @@ -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 -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 -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 -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 Swift diff --git a/tools/lldb-moduleimport-test/lldb-moduleimport-test.cpp b/tools/lldb-moduleimport-test/lldb-moduleimport-test.cpp index 5ae34ef59c3..b6d368ee97c 100644 --- a/tools/lldb-moduleimport-test/lldb-moduleimport-test.cpp +++ b/tools/lldb-moduleimport-test/lldb-moduleimport-test.cpp @@ -46,12 +46,12 @@ void anchorForGetMainExecutable() {} using namespace llvm::MachO; static bool validateModule( - llvm::StringRef data, bool Verbose, bool requiresOSSAModules, + llvm::StringRef data, bool Verbose, swift::serialization::ValidationInfo &info, swift::serialization::ExtendedValidationInfo &extendedInfo, llvm::SmallVectorImpl &searchPaths) { info = swift::serialization::validateSerializedAST( - data, requiresOSSAModules, + data, /*requiredSDK*/ StringRef(), &extendedInfo, /* dependencies*/ nullptr, &searchPaths); if (info.status != swift::serialization::Status::Valid) { @@ -284,9 +284,6 @@ int main(int argc, char **argv) { opt QualifyTypes("qualify-types", desc("Qualify dumped types"), cat(Visible)); - opt EnableOSSAModules("enable-ossa-modules", init(false), - desc("Serialize modules in OSSA"), cat(Visible)); - ParseCommandLineOptions(argc, argv); // Unregister our options so they don't interfere with the command line @@ -331,7 +328,6 @@ int main(int argc, char **argv) { info = {}; extendedInfo = {}; if (!validateModule(StringRef(Module.first, Module.second), Verbose, - EnableOSSAModules, info, extendedInfo, searchPaths)) { llvm::errs() << "Malformed module!\n"; return 1; @@ -355,7 +351,6 @@ int main(int argc, char **argv) { Invocation.setModuleName("lldbtest"); Invocation.getClangImporterOptions().ModuleCachePath = ModuleCachePath; Invocation.getLangOptions().EnableMemoryBufferImporter = true; - Invocation.getSILOptions().EnableOSSAModules = EnableOSSAModules; if (!ResourceDir.empty()) { Invocation.setRuntimeResourcePath(ResourceDir); diff --git a/unittests/FrontendTool/ModuleLoadingTests.cpp b/unittests/FrontendTool/ModuleLoadingTests.cpp index d71c151eb23..6b4c90f956a 100644 --- a/unittests/FrontendTool/ModuleLoadingTests.cpp +++ b/unittests/FrontendTool/ModuleLoadingTests.cpp @@ -111,8 +111,7 @@ protected: ctx->addModuleInterfaceChecker( std::make_unique(*ctx, cacheDir, - prebuiltCacheDir, ModuleInterfaceLoaderOptions(), - swift::RequireOSSAModules_t(silOpts))); + prebuiltCacheDir, ModuleInterfaceLoaderOptions())); auto loader = ModuleInterfaceLoader::create( *ctx, *static_cast( @@ -152,7 +151,7 @@ protected: auto bufData = (*bufOrErr)->getBuffer(); auto validationInfo = serialization::validateSerializedAST( - bufData, silOpts.EnableOSSAModules, + bufData, /*requiredSDK*/StringRef()); ASSERT_EQ(serialization::Status::Valid, validationInfo.status); ASSERT_EQ(bufData, moduleBuffer->getBuffer());