diff --git a/Runtimes/Core/CMakeLists.txt b/Runtimes/Core/CMakeLists.txt index ff1b35cd93e82..1ffa2809b03a9 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 5f60cff85ed9e..3a22cafd43b85 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 59434af525484..af672af6968a9 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/DiagnosticsSema.def b/include/swift/AST/DiagnosticsSema.def index 3ceb50d7e3848..38f25ab9e69cd 100644 --- a/include/swift/AST/DiagnosticsSema.def +++ b/include/swift/AST/DiagnosticsSema.def @@ -958,9 +958,6 @@ ERROR(serialization_target_too_new_repl,none, "deployment target of %0 %3: %4", (StringRef, llvm::VersionTuple, Identifier, llvm::VersionTuple, StringRef)) -ERROR(serialization_non_ossa_module_incompatible, Fatal, - "cannot import non-OSSA module into an OSSA module", - (Identifier)) ERROR(serialization_fatal,Fatal, "fatal error encountered while reading from module '%0'; " diff --git a/include/swift/AST/SILOptions.h b/include/swift/AST/SILOptions.h index f7391c5916dd5..0d365e66fdeaf 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 @@ class SILOptions { /// 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 50661110b2cd0..ad38919e56538 100644 --- a/include/swift/Frontend/ModuleInterfaceLoader.h +++ b/include/swift/Frontend/ModuleInterfaceLoader.h @@ -478,25 +478,6 @@ class ModuleInterfaceLoaderOptions { 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 @@ class ModuleInterfaceLoader : public SerializedModuleLoaderBase { 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 @@ struct InterfaceSubContextDelegateImpl : InterfaceSubContextDelegate { 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 @@ struct InterfaceSubContextDelegateImpl : InterfaceSubContextDelegate { 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 3c84466b79c52..3d034ee45263c 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/SIL/SILModule.h b/include/swift/SIL/SILModule.h index c6fbc05139311..223df90ff99a7 100644 --- a/include/swift/SIL/SILModule.h +++ b/include/swift/SIL/SILModule.h @@ -393,10 +393,6 @@ class SILModule { bool parsedAsSerializedSIL; - /// Set if we have registered a deserialization notification handler for - /// lowering ownership in non transparent functions. - /// This gets set in NonTransparent OwnershipModelEliminator pass. - bool regDeserializationNotificationHandlerForNonTransparentFuncOME; /// Set if we have registered a deserialization notification handler for /// lowering ownership in transparent functions. /// This gets set in OwnershipModelEliminator pass. @@ -449,15 +445,9 @@ class SILModule { deserializationNotificationHandlers.erase(handler); } - bool hasRegisteredDeserializationNotificationHandlerForNonTransparentFuncOME() { - return regDeserializationNotificationHandlerForNonTransparentFuncOME; - } bool hasRegisteredDeserializationNotificationHandlerForAllFuncOME() { return regDeserializationNotificationHandlerForAllFuncOME; } - void setRegisteredDeserializationNotificationHandlerForNonTransparentFuncOME() { - regDeserializationNotificationHandlerForNonTransparentFuncOME = true; - } void setRegisteredDeserializationNotificationHandlerForAllFuncOME() { regDeserializationNotificationHandlerForAllFuncOME = true; } diff --git a/include/swift/SILOptimizer/PassManager/Passes.def b/include/swift/SILOptimizer/PassManager/Passes.def index 3e41897120d94..6c67b1d8f7802 100644 --- a/include/swift/SILOptimizer/PassManager/Passes.def +++ b/include/swift/SILOptimizer/PassManager/Passes.def @@ -377,9 +377,6 @@ LEGACY_PASS(ModulePrinter, "module-printer", "Print the module") LEGACY_PASS(NestedSemanticFunctionCheck, "nested-semantic-function-check", "Diagnose improperly nested '@_semantics' functions") -LEGACY_PASS(NonTransparentFunctionOwnershipModelEliminator, - "non-transparent-func-ownership-model-eliminator", - "Eliminate Ownership Annotations from non-transparent SIL Functions") LEGACY_PASS(RCIdentityDumper, "rc-id-dumper", "Print Reference Count Identities") LEGACY_PASS(AlwaysInlineInliner, "always-inline", diff --git a/include/swift/Serialization/SerializationOptions.h b/include/swift/Serialization/SerializationOptions.h index 8ef9109a9a9d3..19d2a96ffada5 100644 --- a/include/swift/Serialization/SerializationOptions.h +++ b/include/swift/Serialization/SerializationOptions.h @@ -162,7 +162,6 @@ class SerializationOptions { bool StaticLibrary = false; bool HermeticSealAtLink = false; bool EmbeddedSwiftModule = false; - bool IsOSSA = false; bool SkipNonExportableDecls = false; bool ExplicitModuleBuild = false; bool EnableSerializationRemarks = false; diff --git a/include/swift/Serialization/SerializedModuleLoader.h b/include/swift/Serialization/SerializedModuleLoader.h index 25437af3e98ae..c137370177bdf 100644 --- a/include/swift/Serialization/SerializedModuleLoader.h +++ b/include/swift/Serialization/SerializedModuleLoader.h @@ -193,7 +193,6 @@ class SerializedModuleLoaderBase : public ModuleLoader { static llvm::ErrorOr> getMatchingPackageOnlyImportsOfModule(Twine modulePath, bool isFramework, - bool isRequiredOSSAModules, StringRef SDKName, const llvm::Triple &target, StringRef packageName, @@ -222,8 +221,6 @@ class SerializedModuleLoaderBase : public ModuleLoader { 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 33d773d9cef2d..e01254c48b183 100644 --- a/include/swift/Serialization/Validation.h +++ b/include/swift/Serialization/Validation.h @@ -51,9 +51,6 @@ enum class Status { /// The distribution channel doesn't match. ChannelIncompatible, - /// The module is required to be in OSSA, but is not. - NotInOSSA, - /// The module file depends on another module that can't be loaded. MissingDependency, @@ -297,8 +294,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 +304,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 b41852496c884..1384630b739f2 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 d5003db6e2c97..0db8bc41eb60d 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 9ff267001ab53..23aa3e04ec168 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,6 @@ int sil_func_extractor_main(ArrayRef argv, void *MainAddr) { serializationOpts.OutputPath = OutputFile; serializationOpts.SerializeAllSIL = true; serializationOpts.IsSIB = true; - serializationOpts.IsOSSA = options.EnableOSSAModules; symbolgraphgen::SymbolGraphOptions symbolGraphOpts; diff --git a/lib/DriverTool/sil_opt_main.cpp b/lib/DriverTool/sil_opt_main.cpp index 86be1cc01d2b7..aa4f7a5278313 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,6 @@ int sil_opt_main(ArrayRef argv, void *MainAddr) { serializationOpts.OutputPath = OutputFile; serializationOpts.SerializeAllSIL = options.EmitSIB; serializationOpts.IsSIB = options.EmitSIB; - serializationOpts.IsOSSA = SILOpts.EnableOSSAModules; symbolgraphgen::SymbolGraphOptions symbolGraphOptions; diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 390350621a429..6f1784ae6b21f 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 d9c14324ff081..8e51227a5359a 100644 --- a/lib/Frontend/Frontend.cpp +++ b/lib/Frontend/Frontend.cpp @@ -281,8 +281,6 @@ SerializationOptions CompilerInvocation::computeSerializationOptions( serializationOpts.SerializeDebugInfoSIL = true; } - serializationOpts.IsOSSA = getSILOptions().EnableOSSAModules; - serializationOpts.SkipNonExportableDecls = getLangOptions().SkipNonExportableDecls; @@ -792,8 +790,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 +864,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 +906,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 be3dd3520cfdd..c44c5c1dab138 100644 --- a/lib/Frontend/ModuleInterfaceBuilder.cpp +++ b/lib/Frontend/ModuleInterfaceBuilder.cpp @@ -310,7 +310,6 @@ std::error_code ExplicitModuleInterfaceBuilder::buildSwiftModuleFromInterface( return std::make_error_code(std::errc::not_supported); SerializationOpts.Dependencies = Deps; } - SerializationOpts.IsOSSA = SILOpts.EnableOSSAModules; 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 fade5b2bf48d3..0902ea421ba02 100644 --- a/lib/Frontend/ModuleInterfaceLoader.cpp +++ b/lib/Frontend/ModuleInterfaceLoader.cpp @@ -213,10 +213,8 @@ class DiscoveredModule { 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 @@ class UpToDateModuleCheker { 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 7544562cfe3d3..95d8863b6f68c 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,6 @@ static bool serializeSIB(SILModule *SM, const PrimarySpecificPaths &PSPs, serializationOpts.OutputPath = moduleOutputPath; serializationOpts.SerializeAllSIL = true; serializationOpts.IsSIB = true; - serializationOpts.IsOSSA = Context.SILOpts.EnableOSSAModules; symbolgraphgen::SymbolGraphOptions symbolGraphOptions; diff --git a/lib/SIL/IR/SILModule.cpp b/lib/SIL/IR/SILModule.cpp index d187ca133d3ef..df0f588565155 100644 --- a/lib/SIL/IR/SILModule.cpp +++ b/lib/SIL/IR/SILModule.cpp @@ -112,7 +112,6 @@ SILModule::SILModule(llvm::PointerUnion context, : Stage(SILStage::Raw), loweredAddresses(!Options.EnableSILOpaqueValues), indexTrieRoot(new IndexTrieNode()), Options(Options), irgenOptions(irgenOptions), serialized(false), - regDeserializationNotificationHandlerForNonTransparentFuncOME(false), regDeserializationNotificationHandlerForAllFuncOME(false), hasAccessMarkerHandler(false), prespecializedFunctionDeclsImported(false), SerializeSILAction(), diff --git a/lib/SILOptimizer/Mandatory/OwnershipModelEliminator.cpp b/lib/SILOptimizer/Mandatory/OwnershipModelEliminator.cpp index 191d52677aeec..66184f6c8b21c 100644 --- a/lib/SILOptimizer/Mandatory/OwnershipModelEliminator.cpp +++ b/lib/SILOptimizer/Mandatory/OwnershipModelEliminator.cpp @@ -871,17 +871,6 @@ static bool stripOwnership(SILFunction &func) { return madeChange; } -static void prepareNonTransparentSILFunctionForOptimization(ModuleDecl *, - SILFunction *f) { - if (!f->hasOwnership() || f->isTransparent()) - return; - - LLVM_DEBUG(llvm::dbgs() << "After deserialization, stripping ownership in:" - << f->getName() << "\n"); - - stripOwnership(*f); -} - static void prepareSILFunctionForOptimization(ModuleDecl *, SILFunction *f) { if (!f->hasOwnership()) return; @@ -895,11 +884,7 @@ static void prepareSILFunctionForOptimization(ModuleDecl *, SILFunction *f) { namespace { struct OwnershipModelEliminator : SILFunctionTransform { - bool skipTransparent; - bool skipStdlibModule; - - OwnershipModelEliminator(bool skipTransparent, bool skipStdlibModule) - : skipTransparent(skipTransparent), skipStdlibModule(skipStdlibModule) {} + OwnershipModelEliminator() {} void run() override { if (DumpBefore.size()) { @@ -909,20 +894,9 @@ struct OwnershipModelEliminator : SILFunctionTransform { auto *f = getFunction(); auto &mod = getFunction()->getModule(); - // If we are supposed to skip the stdlib module and we are in the stdlib - // module bail. - if (skipStdlibModule && mod.isStdlibModule()) { - return; - } - if (!f->hasOwnership()) return; - // If we were asked to not strip ownership from transparent functions in - // /our/ module, return. - if (skipTransparent && f->isTransparent()) - return; - // Verify here to make sure ownership is correct before we strip. { // Add a pretty stack trace entry to tell users who see a verification @@ -950,25 +924,14 @@ struct OwnershipModelEliminator : SILFunctionTransform { invalidateAnalysis(InvalidKind); } - // If we were asked to strip transparent, we are at the beginning of the - // performance pipeline. In such a case, we register a handler so that all - // future things we deserialize have ownership stripped. + // Register a handler so that all future things we deserialize have ownership stripped. using NotificationHandlerTy = FunctionBodyDeserializationNotificationHandler; std::unique_ptr ptr; - if (skipTransparent) { - if (!mod.hasRegisteredDeserializationNotificationHandlerForNonTransparentFuncOME()) { - ptr.reset(new NotificationHandlerTy( - prepareNonTransparentSILFunctionForOptimization)); - mod.registerDeserializationNotificationHandler(std::move(ptr)); - mod.setRegisteredDeserializationNotificationHandlerForNonTransparentFuncOME(); - } - } else { - if (!mod.hasRegisteredDeserializationNotificationHandlerForAllFuncOME()) { - ptr.reset(new NotificationHandlerTy(prepareSILFunctionForOptimization)); - mod.registerDeserializationNotificationHandler(std::move(ptr)); - mod.setRegisteredDeserializationNotificationHandlerForAllFuncOME(); - } + if (!mod.hasRegisteredDeserializationNotificationHandlerForAllFuncOME()) { + ptr.reset(new NotificationHandlerTy(prepareSILFunctionForOptimization)); + mod.registerDeserializationNotificationHandler(std::move(ptr)); + mod.setRegisteredDeserializationNotificationHandlerForAllFuncOME(); } } }; @@ -976,11 +939,5 @@ struct OwnershipModelEliminator : SILFunctionTransform { } // end anonymous namespace SILTransform *swift::createOwnershipModelEliminator() { - return new OwnershipModelEliminator(false /*skip transparent*/, - false /*ignore stdlib*/); -} - -SILTransform *swift::createNonTransparentFunctionOwnershipModelEliminator() { - return new OwnershipModelEliminator(true /*skip transparent*/, - false /*ignore stdlib*/); + return new OwnershipModelEliminator(); } diff --git a/lib/SILOptimizer/PassManager/PassManager.cpp b/lib/SILOptimizer/PassManager/PassManager.cpp index 5a43810450fcd..09219670b4c8f 100644 --- a/lib/SILOptimizer/PassManager/PassManager.cpp +++ b/lib/SILOptimizer/PassManager/PassManager.cpp @@ -577,8 +577,6 @@ void SILPassManager::dumpPassInfo(const char *Title, unsigned TransIdx, bool SILPassManager::isMandatoryFunctionPass(SILFunctionTransform *sft) { return isMandatory || - sft->getPassKind() == - PassKind::NonTransparentFunctionOwnershipModelEliminator || sft->getPassKind() == PassKind::OwnershipModelEliminator; } diff --git a/lib/SILOptimizer/PassManager/PassPipeline.cpp b/lib/SILOptimizer/PassManager/PassPipeline.cpp index e3787c74967bb..8913a46217d74 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 1c6d9ba79cfc9..51eab585e2770 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 3b8131199edbf..e23a263c59b55 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 11861d3262ad8..98dca3cfdf402 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, @@ -484,12 +483,6 @@ static ValidationInfo validateControlBlock( } break; } - case control_block::IS_OSSA: { - auto isModuleInOSSA = scratch[0]; - if (requiresOSSAModules && !isModuleInOSSA) - result.status = Status::NotInOSSA; - break; - } default: // Unknown metadata record, possibly for use by a future version of the // module format. @@ -593,7 +586,6 @@ std::string serialization::StatusToString(Status S) { case Status::FormatTooNew: return "FormatTooNew"; case Status::RevisionIncompatible: return "RevisionIncompatible"; case Status::ChannelIncompatible: return "ChannelIncompatible"; - case Status::NotInOSSA: return "NotInOSSA"; case Status::MissingDependency: return "MissingDependency"; case Status::MissingUnderlyingModule: return "MissingUnderlyingModule"; case Status::CircularDependency: return "CircularDependency"; @@ -615,7 +607,7 @@ bool serialization::isSerializedAST(StringRef data) { } ValidationInfo serialization::validateSerializedAST( - StringRef data, bool requiresOSSAModules, + StringRef data, StringRef requiredSDK, ExtendedValidationInfo *extendedInfo, SmallVectorImpl *dependencies, @@ -661,7 +653,6 @@ ValidationInfo serialization::validateSerializedAST( result = validateControlBlock( cursor, scratch, {SWIFTMODULE_VERSION_MAJOR, SWIFTMODULE_VERSION_MINOR}, - requiresOSSAModules, /*requiresRevisionMatch=*/true, requiredSDK, target, extendedInfo, localObfuscator); @@ -1213,7 +1204,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 +1349,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 +1428,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 +1480,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 8d1c4db13fea8..ca0a132e82bb0 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 @@ class ModuleFileSharedCore { 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 @@ class ModuleFileSharedCore { /// 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 @@ class ModuleFileSharedCore { 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 @@ class ModuleFileSharedCore { 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/ModuleFormat.h b/lib/Serialization/ModuleFormat.h index bfa13c6540bd7..22e56f3ebd9b7 100644 --- a/lib/Serialization/ModuleFormat.h +++ b/lib/Serialization/ModuleFormat.h @@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0; /// describe what change you made. The content of this comment isn't important; /// it just ensures a conflict if two people change the module format. /// Don't worry about adhering to the 80-column limit for this line. -const uint16_t SWIFTMODULE_VERSION_MINOR = 961; // borrow/mutate accessors +const uint16_t SWIFTMODULE_VERSION_MINOR = 962; // remove IS_OSSA flag from header /// A standard hash seed used for all string hashes in a serialized module. /// @@ -905,7 +905,6 @@ namespace control_block { TARGET, SDK_NAME, REVISION, - IS_OSSA, ALLOWABLE_CLIENT_NAME, CHANNEL, SDK_VERSION, @@ -944,11 +943,6 @@ namespace control_block { BCBlob >; - using IsOSSALayout = BCRecordLayout< - IS_OSSA, - BCFixed<1> - >; - using AllowableClientLayout = BCRecordLayout< ALLOWABLE_CLIENT_NAME, BCBlob diff --git a/lib/Serialization/ScanningLoaders.cpp b/lib/Serialization/ScanningLoaders.cpp index 9029739e2639b..a3f9f023d8bcd 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/Serialization.cpp b/lib/Serialization/Serialization.cpp index ba0174f1d6c51..a53aee6299c4d 100644 --- a/lib/Serialization/Serialization.cpp +++ b/lib/Serialization/Serialization.cpp @@ -840,7 +840,6 @@ void Serializer::writeBlockInfoBlock() { BLOCK_RECORD(control_block, TARGET); BLOCK_RECORD(control_block, SDK_NAME); BLOCK_RECORD(control_block, REVISION); - BLOCK_RECORD(control_block, IS_OSSA); BLOCK_RECORD(control_block, ALLOWABLE_CLIENT_NAME); BLOCK_RECORD(control_block, CHANNEL); BLOCK_RECORD(control_block, SDK_VERSION); @@ -1016,7 +1015,6 @@ void Serializer::writeHeader() { control_block::SDKVersionLayout SDKVersion(Out); control_block::RevisionLayout Revision(Out); control_block::ChannelLayout Channel(Out); - control_block::IsOSSALayout IsOSSA(Out); control_block::AllowableClientLayout Allowable(Out); // Write module 'real name', which can be different from 'name' @@ -1073,8 +1071,6 @@ void Serializer::writeHeader() { Channel.emit(ScratchRecord, version::getCurrentCompilerChannel()); - IsOSSA.emit(ScratchRecord, Options.IsOSSA); - { llvm::BCBlockRAII restoreBlock(Out, OPTIONS_BLOCK_ID, 4); diff --git a/lib/Serialization/SerializedModuleLoader.cpp b/lib/Serialization/SerializedModuleLoader.cpp index 07878cd69b853..bcedbc8d0471e 100644 --- a/lib/Serialization/SerializedModuleLoader.cpp +++ b/lib/Serialization/SerializedModuleLoader.cpp @@ -313,8 +313,6 @@ std::optional SerializedModuleLoaderBase::invalidModuleReason(seria return "compiled with a different version of the compiler"; case Status::ChannelIncompatible: return "compiled for a different distribution channel"; - case Status::NotInOSSA: - return "module was not built with OSSA"; case Status::MissingDependency: return "missing dependency"; case Status::MissingUnderlyingModule: @@ -343,7 +341,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 +353,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 +951,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 +1110,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, @@ -1154,14 +1147,6 @@ void swift::serialization::diagnoseSerializedASTLoadFailure( Ctx.Diags.diagnose(diagLoc, diag::serialization_module_too_old, ModuleName, moduleBufferID); break; - case serialization::Status::NotInOSSA: - if (Ctx.SerializationOpts.ExplicitModuleBuild || - Ctx.SILOpts.EnableOSSAModules) { - 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, loadInfo.problematicRevision, ModuleName, moduleBufferID); @@ -1256,7 +1241,6 @@ void swift::serialization::diagnoseSerializedASTLoadFailureTransitive( case serialization::Status::Valid: case serialization::Status::FormatTooNew: case serialization::Status::FormatTooOld: - case serialization::Status::NotInOSSA: case serialization::Status::RevisionIncompatible: case serialization::Status::ChannelIncompatible: case serialization::Status::Malformed: @@ -1498,7 +1482,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 +1537,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 825e414d34622..e47c9db33ab65 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 2e4970c3e4e7a..9cef1492417c0 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 357aef5546974..7eeb1b4bc2ad3 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 2c9503459735c..e596f6374adfa 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 8071848bbd2c2..ed5ba13c890b6 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 d3be7489ef4bd..b063400ef52de 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 55f7d13d336d3..3dc1701c0426e 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 41d380d50ee01..29e2cb6b4909e 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 40c85f5a569b4..ad8fe95ac2974 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 e0adcd7a7d78e..5c82d89e9fea0 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/ome_non_transparent.sil b/test/SILOptimizer/ome_non_transparent.sil deleted file mode 100644 index 7a01cd2caa096..0000000000000 --- a/test/SILOptimizer/ome_non_transparent.sil +++ /dev/null @@ -1,19 +0,0 @@ -// RUN: %target-sil-opt -non-transparent-func-ownership-model-eliminator %s | %FileCheck %s - -sil_stage raw - -import Builtin - -// CHECK-LABEL: sil [transparent] [ossa] @foo : $@convention(thin) () -> () { -sil [transparent] [ossa] @foo : $@convention(thin) () -> () { -bb0: - %9999 = tuple() - return %9999 : $() -} - -// CHECK-LABEL: sil @bar : $@convention(thin) () -> () { -sil [ossa] @bar : $@convention(thin) () -> () { -bb0: - %9999 = tuple() - return %9999 : $() -} diff --git a/test/SILOptimizer/ome_strip_deserialize.sil b/test/SILOptimizer/ome_strip_deserialize.sil index 195628852609f..2a042e611bb11 100644 --- a/test/SILOptimizer/ome_strip_deserialize.sil +++ b/test/SILOptimizer/ome_strip_deserialize.sil @@ -1,7 +1,6 @@ // RUN: %empty-directory(%t) // RUN: %target-swift-frontend -parse-sil -module-name OMEStripDeserializationInput %S/Inputs/ome_strip_deserialize_input.sil -emit-module -o %t/OMEStripDeserializationInput.swiftmodule -// RUN: %target-sil-opt -non-transparent-func-ownership-model-eliminator -performance-linker -I %t %s | %FileCheck %s -// RUN: %target-sil-opt -ownership-model-eliminator -performance-linker -I %t %s | %FileCheck --check-prefix=CHECK-STRIP-ALL %s +// RUN: %target-sil-opt -ownership-model-eliminator -performance-linker -I %t %s | %FileCheck %s sil_stage canonical @@ -11,22 +10,14 @@ import OMEStripDeserializationInput // ownership SIL. // CHECK-LABEL: sil public_external [serialized] @bar : $@convention(thin) () -> () -// CHECK: } // end sil function 'bar' - -// CHECK-STRIP-ALL-LABEL: sil public_external [serialized] @bar : $@convention(thin) () -> () -// CHECK-STRIP-ALL: } // end sil function 'bar' +// CHECK: } // end sil function 'bar' sil [ossa] @bar : $@convention(thin) () -> () -// CHECK-LABEL: sil public_external [transparent] [serialized] [ossa] @transparent_bar : $@convention(thin) () -> () -// CHECK: } // end sil function 'transparent_bar' - -// CHECK-STRIP-ALL-LABEL: sil public_external [transparent] [serialized] @transparent_bar : $@convention(thin) () -> () -// CHECK-STRIP-ALL: } // end sil function 'transparent_bar' +// CHECK-LABEL: sil public_external [transparent] [serialized] @transparent_bar : $@convention(thin) () -> () +// CHECK: } // end sil function 'transparent_bar' sil [transparent] [ossa] @transparent_bar : $@convention(thin) () -> () -// CHECK-LABEL: sil @foo : $@convention(thin) () -> () { -// CHECK: } // end sil function 'foo' sil [ossa] @foo : $@convention(thin) () -> () { bb0: %0 = function_ref @bar : $@convention(thin) () -> () diff --git a/test/SILOptimizer/opaque_values_mandatory.sil b/test/SILOptimizer/opaque_values_mandatory.sil index 7a5128afc550f..f30aec82a88cc 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 0ce95478c83bd..e4a23fe066320 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 184f932f5eaa3..ccfdeebe099f0 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 954edd7329dc0..aad1d654fa4e6 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 5eac09217bae4..dbaca018691f0 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 569d37514fb53..8b55f020e081e 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 5410b986f620d..8deab7259639e 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 4b9bee2308ea3..43e3effecb212 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 676b2a36e6153..410161abd79ce 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 6c3a7c86a4097..944b792f0473d 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 030d2d17d8484..0000000000000 --- 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 b8bb3d41d1f80..d67ac94619640 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 e37edf570ba70..750098583880f 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 49ee238d3a0a4..2233e8cc199c7 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 ac51333f47c73..a51e9d32e62d9 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 5ae34ef59c367..b6d368ee97c81 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 d71c151eb239b..6b4c90f956a36 100644 --- a/unittests/FrontendTool/ModuleLoadingTests.cpp +++ b/unittests/FrontendTool/ModuleLoadingTests.cpp @@ -111,8 +111,7 @@ class ModuleInterfaceLoaderTest : public testing::Test { 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 @@ class ModuleInterfaceLoaderTest : public testing::Test { 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());