Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Runtimes/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ add_compile_options(
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>"
"$<$<COMPILE_LANGUAGE:Swift>:-no-link-objc-runtime>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enforce-exclusivity=unchecked>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-ossa-modules>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -empty-abi-descriptor>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>"
"$<$<AND:$<NOT:$<BOOL:${SwiftCore_ENABLE_OBJC_INTEROP}>>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -disable-objc-interop>"
Expand Down
1 change: 0 additions & 1 deletion Runtimes/Overlay/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ add_compile_options(
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-concurrency-module-import>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -disable-implicit-string-processing-module-import>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enforce-exclusivity=unchecked>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-ossa-modules>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -target-min-inlining-version -Xfrontend min>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")
Expand Down
1 change: 0 additions & 1 deletion Runtimes/Supplemental/Observation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ add_compile_options(
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature Macros>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature ExtensionMacros>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-lexical-lifetimes=false>"
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-Xfrontend -enable-ossa-modules>"
"$<$<COMPILE_LANGUAGE:Swift>:-warn-implicit-overrides>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_LIBRARY_EVOLUTION}>,$<COMPILE_LANGUAGE:Swift>>:-enable-library-evolution>"
"$<$<AND:$<BOOL:${${PROJECT_NAME}_ENABLE_PRESPECIALIZATION}>,$<COMPILE_LANGUAGE:Swift>>:SHELL:-Xfrontend -prespecialize-generic-metadata>")
Expand Down
3 changes: 0 additions & 3 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -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'; "
Expand Down
10 changes: 2 additions & 8 deletions include/swift/AST/SILOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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;
Expand Down
36 changes: 6 additions & 30 deletions include/swift/Frontend/ModuleInterfaceLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,49 +478,27 @@ 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;
std::string CacheDir;
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<std::string>
getCompiledModuleCandidatesForInterface(StringRef moduleName,
StringRef interfacePath) override;
Expand Down Expand Up @@ -596,7 +574,6 @@ class ModuleInterfaceLoader : public SerializedModuleLoaderBase {
ArrayRef<std::pair<std::string, std::string>> replayPrefixMap,
bool SerializeDependencyHashes, bool TrackSystemDependencies,
ModuleInterfaceLoaderOptions Opts,
RequireOSSAModules_t RequireOSSAModules,
bool silenceInterfaceDiagnostics);

/// Unconditionally build \p InPath (a swiftinterface file) to \p OutPath (as
Expand Down Expand Up @@ -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,
Expand All @@ -684,7 +660,7 @@ struct InterfaceSubContextDelegateImpl : InterfaceSubContextDelegate {
StringRef backupModuleInterfaceDir,
ArrayRef<std::pair<std::string, std::string>> replayPrefixMap,
bool serializeDependencyHashes,
bool trackSystemDependencies, RequireOSSAModules_t requireOSSAModules);
bool trackSystemDependencies);

template<typename ...ArgTypes>
static InFlightDiagnostic diagnose(StringRef interfacePath,
Expand Down
3 changes: 1 addition & 2 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -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">,
Expand Down
10 changes: 0 additions & 10 deletions include/swift/SIL/SILModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 0 additions & 3 deletions include/swift/SILOptimizer/PassManager/Passes.def
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion include/swift/Serialization/SerializationOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions include/swift/Serialization/SerializedModuleLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ class SerializedModuleLoaderBase : public ModuleLoader {
static llvm::ErrorOr<std::vector<ScannerImportStatementInfo>>
getMatchingPackageOnlyImportsOfModule(Twine modulePath,
bool isFramework,
bool isRequiredOSSAModules,
StringRef SDKName,
const llvm::Triple &target,
StringRef packageName,
Expand Down Expand Up @@ -222,8 +221,6 @@ class SerializedModuleLoaderBase : public ModuleLoader {
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
bool isFramework);

bool isRequiredOSSAModules() const;

/// Check whether the module with a given name can be imported without
/// importing it.
///
Expand Down
7 changes: 1 addition & 6 deletions include/swift/Serialization/Validation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down Expand Up @@ -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
Expand All @@ -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<SerializationOptions::FileDependency> *dependencies =
Expand Down
2 changes: 1 addition & 1 deletion lib/ASTSectionImporter/ASTSectionImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions lib/DependencyScan/ModuleDependencyScanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ ModuleDependencyScanningWorker::ModuleDependencyScanningWorker(
workerCompilerInvocation->getFrontendOptions()
.SerializeModuleInterfaceDependencyHashes,
workerCompilerInvocation->getFrontendOptions()
.shouldTrackSystemDependencies(),
RequireOSSAModules_t(SILOptions));
.shouldTrackSystemDependencies()
);

auto loader = std::make_unique<PluginLoader>(
*workerASTContext, /*DepTracker=*/nullptr,
Expand Down
8 changes: 0 additions & 8 deletions lib/DriverTool/sil_func_extractor_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ struct SILFuncExtractorOptions {
llvm::cl::init(false),
llvm::cl::desc("Do not dump AST."));

llvm::cl::opt<bool> EnableOSSAModules = llvm::cl::opt<bool>(
"enable-ossa-modules", llvm::cl::init(true),
llvm::cl::desc("Do we always serialize SIL in OSSA form? If "
"this is disabled we do not serialize in OSSA "
"form when optimizing."));

llvm::cl::opt<llvm::cl::boolOrDefault>
EnableObjCInterop = llvm::cl::opt<llvm::cl::boolOrDefault>(
"enable-objc-interop",
Expand Down Expand Up @@ -275,7 +269,6 @@ int sil_func_extractor_main(ArrayRef<const char *> 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;
Expand Down Expand Up @@ -368,7 +361,6 @@ int sil_func_extractor_main(ArrayRef<const char *> argv, void *MainAddr) {
serializationOpts.OutputPath = OutputFile;
serializationOpts.SerializeAllSIL = true;
serializationOpts.IsSIB = true;
serializationOpts.IsOSSA = options.EnableOSSAModules;

symbolgraphgen::SymbolGraphOptions symbolGraphOpts;

Expand Down
8 changes: 0 additions & 8 deletions lib/DriverTool/sil_opt_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,6 @@ struct SILOptOptions {
EnableMoveInoutStackProtection = llvm::cl::opt<bool>("enable-move-inout-stack-protector",
llvm::cl::desc("Enable the stack protector by moving values to temporaries."));

llvm::cl::opt<bool> EnableOSSAModules = llvm::cl::opt<bool>(
"enable-ossa-modules", llvm::cl::init(true),
llvm::cl::desc("Do we always serialize SIL in OSSA form? If "
"this is disabled we do not serialize in OSSA "
"form when optimizing."));

cl::opt<EnforceExclusivityMode>
EnforceExclusivity = cl::opt<EnforceExclusivityMode>(
"enforce-exclusivity", cl::desc("Enforce law of exclusivity "
Expand Down Expand Up @@ -902,7 +896,6 @@ int sil_opt_main(ArrayRef<const char *> 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;
Expand Down Expand Up @@ -1088,7 +1081,6 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
serializationOpts.OutputPath = OutputFile;
serializationOpts.SerializeAllSIL = options.EmitSIB;
serializationOpts.IsSIB = options.EmitSIB;
serializationOpts.IsOSSA = SILOpts.EnableOSSAModules;

symbolgraphgen::SymbolGraphOptions symbolGraphOptions;

Expand Down
5 changes: 0 additions & 5 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -4244,7 +4241,6 @@ CompilerInvocation::loadFromSerializedAST(StringRef data) {
serialization::ValidationInfo info =
serialization::validateSerializedAST(
data,
getSILOptions().EnableOSSAModules,
LangOpts.SDKName,
&extendedInfo);

Expand Down Expand Up @@ -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;
Expand Down
11 changes: 3 additions & 8 deletions lib/Frontend/Frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ SerializationOptions CompilerInvocation::computeSerializationOptions(
serializationOpts.SerializeDebugInfoSIL = true;
}

serializationOpts.IsOSSA = getSILOptions().EnableOSSAModules;

serializationOpts.SkipNonExportableDecls =
getLangOptions().SkipNonExportableDecls;

Expand Down Expand Up @@ -792,8 +790,7 @@ bool CompilerInstance::setUpModuleLoaders() {
Context->addModuleInterfaceChecker(
std::make_unique<ModuleInterfaceCheckerImpl>(
*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.
Expand Down Expand Up @@ -867,8 +864,7 @@ bool CompilerInstance::setUpModuleLoaders() {
Context->addModuleInterfaceChecker(
std::make_unique<ModuleInterfaceCheckerImpl>(
*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) {
Expand Down Expand Up @@ -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;
Expand Down
Loading