Skip to content

Remove some remaining dead code from the +0 argument convention bring… #22161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,6 @@ option(SWIFT_STDLIB_ENABLE_SIL_OWNERSHIP
"Build the standard libraries and overlays with sil ownership enabled."
FALSE)

option(SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS
"Build the standard libraries, overlays, and runtime with normal arguments at +0"
TRUE)

option(SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS
"Enable runtime function counters and expose the API."
FALSE)
Expand Down Expand Up @@ -811,20 +807,17 @@ message(STATUS "Building host Swift tools for ${SWIFT_HOST_VARIANT_SDK} ${SWIFT_
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS " Assertions: ${LLVM_ENABLE_ASSERTIONS}")
message(STATUS " LTO: ${SWIFT_TOOLS_ENABLE_LTO}")
message(STATUS " +0 Normal Args: ${SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS}")
message(STATUS "")

if (SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)

message(STATUS "Building Swift standard library and overlays for SDKs: ${SWIFT_SDKS}")
message(STATUS " Build type: ${SWIFT_STDLIB_BUILD_TYPE}")
message(STATUS " Assertions: ${SWIFT_STDLIB_ASSERTIONS}")
message(STATUS " +0 Normal Args: ${SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS}")
message(STATUS "")

message(STATUS "Building Swift runtime with:")
message(STATUS " Leak Detection Checker Entrypoints: ${SWIFT_RUNTIME_ENABLE_LEAK_CHECKER}")
message(STATUS " +0 Normal Args: ${SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS}")
message(STATUS "")

else()
Expand Down
4 changes: 0 additions & 4 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -369,10 +369,6 @@ function(_add_variant_swift_compile_flags
list(APPEND result "-D" "INTERNAL_CHECKS_ENABLED")
endif()

if (NOT SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS)
list(APPEND result "-Xfrontend" "-disable-guaranteed-normal-arguments")
endif()

if(SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS)
list(APPEND result "-D" "SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS")
endif()
Expand Down
3 changes: 0 additions & 3 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,6 @@ def pch_disable_validation : Flag<["-"], "pch-disable-validation">,
def enable_sil_ownership : Flag<["-"], "enable-sil-ownership">,
HelpText<"Enable the SIL Ownership Model">;

def disable_guaranteed_normal_arguments : Flag<["-"], "disable-guaranteed-normal-arguments">,
HelpText<"If set to true, all normal parameters (except to inits/setters) will be passed at +1">;

def enable_mandatory_semantic_arc_opts : Flag<["-"], "enable-mandatory-semantic-arc-opts">,
HelpText<"Enable the mandatory semantic arc optimizer">;

Expand Down
15 changes: 5 additions & 10 deletions lib/SIL/SILFunctionType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1240,12 +1240,6 @@ getSILFunctionTypeForAbstractCFunction(SILModule &M,
AnyFunctionType::ExtInfo extInfo,
Optional<SILDeclRef> constant);

/// If EnableGuaranteedNormalArguments is set, return a default convention that
/// uses guaranteed.
static DefaultConventions getNormalArgumentConvention(SILModule &M) {
return DefaultConventions(NormalParameterConvention::Guaranteed);
}

static CanSILFunctionType getNativeSILFunctionType(
SILModule &M, AbstractionPattern origType,
CanAnyFunctionType substInterfaceType, AnyFunctionType::ExtInfo extInfo,
Expand Down Expand Up @@ -1294,11 +1288,12 @@ static CanSILFunctionType getNativeSILFunctionType(
case SILDeclRef::Kind::DefaultArgGenerator:
case SILDeclRef::Kind::StoredPropertyInitializer:
case SILDeclRef::Kind::IVarInitializer:
case SILDeclRef::Kind::IVarDestroyer:
return getSILFunctionType(M, origType, substInterfaceType, extInfo,
getNormalArgumentConvention(M), ForeignInfo(),
origConstant, constant, reqtSubs,
case SILDeclRef::Kind::IVarDestroyer: {
auto conv = DefaultConventions(NormalParameterConvention::Guaranteed);
return getSILFunctionType(M, origType, substInterfaceType, extInfo, conv,
ForeignInfo(), origConstant, constant, reqtSubs,
witnessMethodConformance);
}
case SILDeclRef::Kind::Deallocator:
return getSILFunctionType(M, origType, substInterfaceType, extInfo,
DeallocatorConventions(), ForeignInfo(),
Expand Down
6 changes: 0 additions & 6 deletions test/Frontend/emit-plus-one-normal-arguments.swift

This file was deleted.

17 changes: 0 additions & 17 deletions test/sil-opt/guaranteed-normal-args-negative.sil

This file was deleted.

17 changes: 0 additions & 17 deletions test/sil-opt/guaranteed-normal-args-positive.sil

This file was deleted.

6 changes: 0 additions & 6 deletions tools/sil-opt/SILOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,6 @@ DisableASTDump("sil-disable-ast-dump", llvm::cl::Hidden,
static llvm::cl::opt<bool>
PerformWMO("wmo", llvm::cl::desc("Enable whole-module optimizations"));

static llvm::cl::opt<bool> DisableGuaranteedNormalArguments(
"disable-guaranteed-normal-arguments", llvm::cl::Hidden,
llvm::cl::init(false),
llvm::cl::desc("Assume that the input module was compiled with "
"-disable-guaranteed-normal-arguments enabled"));

static llvm::cl::opt<bool>
EnableExperimentalStaticAssert(
"enable-experimental-static-assert", llvm::cl::Hidden,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ def __init__(self, args, toolchain, source_dir, build_dir):
# Add any sil ownership flags.
self.cmake_options.extend(self._sil_ownership_flags)

# Add any guaranteed normal arguments flags
self.cmake_options.extend(self._guaranteed_normal_arguments_flags)

# Generate the compile db.
self.cmake_options.extend(self._compile_db_flags)

Expand Down Expand Up @@ -115,12 +112,6 @@ def _sil_ownership_flags(self):
return ["-DSWIFT_STDLIB_ENABLE_SIL_OWNERSHIP=FALSE"]
return ["-DSWIFT_STDLIB_ENABLE_SIL_OWNERSHIP=TRUE"]

@property
def _guaranteed_normal_arguments_flags(self):
if self.args.disable_guaranteed_normal_arguments:
return ["-DSWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS=FALSE"]
return ["-DSWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS=TRUE"]

@property
def _compile_db_flags(self):
return ['-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE']
Expand Down
14 changes: 0 additions & 14 deletions utils/swift_build_support/tests/products/test_swift.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def test_by_default_no_cmake_options(self):
expected = [
'-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE',
'-DSWIFT_STDLIB_ENABLE_SIL_OWNERSHIP=FALSE',
'-DSWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS=FALSE',
'-DSWIFT_FORCE_OPTIMIZED_TYPECHECKER=FALSE',
'-DSWIFT_STDLIB_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING=FALSE'
]
Expand All @@ -105,7 +104,6 @@ def test_swift_runtime_tsan(self):
'-DSWIFT_RUNTIME_USE_SANITIZERS=Thread',
'-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE',
'-DSWIFT_STDLIB_ENABLE_SIL_OWNERSHIP=FALSE',
'-DSWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS=FALSE',
'-DSWIFT_FORCE_OPTIMIZED_TYPECHECKER=FALSE',
'-DSWIFT_STDLIB_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING=FALSE'
]
Expand Down Expand Up @@ -295,18 +293,6 @@ def test_sil_ownership_flags(self):
[x for x in swift.cmake_options
if 'SWIFT_STDLIB_ENABLE_SIL_OWNERSHIP' in x])

def test_swift_guaranteed_normal_arguments_flags(self):
self.args.disable_guaranteed_normal_arguments = False
swift = Swift(
args=self.args,
toolchain=self.toolchain,
source_dir='/path/to/src',
build_dir='/path/to/build')
self.assertEqual(
['-DSWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS=TRUE'],
[x for x in swift.cmake_options
if 'SWIFT_ENABLE_GUARANTEED_NORMAL_ARGUMENTS' in x])

def test_force_optimized_typechecker_flags(self):
self.args.force_optimized_typechecker = True
swift = Swift(
Expand Down