Skip to content
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

[Constraint solver] Fix function builders with single-expression closures #29626

Conversation

DougGregor
Copy link
Member

Fix a few related issues involving the interaction with
single-expression closures:

  • A single-expression closure can have a "return" in it; in such
    cases, disable the function-builder transform.
  • Have the function builder constraint generator look through the
    "return" statement in a single-expression closure the same way as
    solution application does

Fixes rdar://problem/59045763, where we rejected some well-formed code
involving a single-expression closure with a "return" keyword.

Ye olde "break should have been continue" bug. This undoubtedly has
problems elsewhere, but I don't have a specific case until the next
commit.
…ures

Fix a few related issues involving the interaction with
single-expression closures:

* A single-expression closure can have a "return" in it; in such
cases, disable the function-builder transform.
* Have the function builder constraint generator look through the
"return" statement in a single-expression closure the same way as
solution application does

Fixes rdar://problem/59045763, where we rejected some well-formed code
involving a single-expression closure with a "return" keyword.
@DougGregor DougGregor requested a review from xedin February 4, 2020 01:57
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test compiler performance

@DougGregor
Copy link
Member Author

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

swift-ci commented Feb 4, 2020

Summary for master smoketest

No regressions above thresholds

Debug

debug brief

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 962,208,678,529 966,836,152,289 4,627,473,760 0.48%
LLVM.NumLLVMBytesOutput 50,752,884 50,752,524 -360 -0.0%
time.swift-driver.wall 79.1s 79.2s 190.1ms 0.24%

debug detailed

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (18)
name old new delta delta_pct
AST.NumLoadedModules 6,089 6,089 0 0.0%
AST.NumTotalClangImportedEntities 162,106 162,227 121 0.07%
IRModule.NumIRBasicBlocks 189,026 189,026 0 0.0%
IRModule.NumIRFunctions 101,615 101,615 0 0.0%
IRModule.NumIRGlobals 110,101 110,101 0 0.0%
IRModule.NumIRInsts 2,076,125 2,076,125 0 0.0%
IRModule.NumIRValueSymbols 193,072 193,072 0 0.0%
LLVM.NumLLVMBytesOutput 50,752,884 50,752,524 -360 -0.0%
SILModule.NumSILGenFunctions 49,397 49,397 0 0.0%
SILModule.NumSILOptFunctions 67,748 67,748 0 0.0%
Sema.NumConformancesDeserialized 195,948 196,501 553 0.28%
Sema.NumConstraintScopes 982,920 982,988 68 0.01%
Sema.NumDeclsDeserialized 1,559,099 1,563,137 4,038 0.26%
Sema.NumFunctionsTypechecked 10,984 10,984 0 0.0%
Sema.NumGenericSignatureBuilders 27,610 27,631 21 0.08%
Sema.NumLazyIterableDeclContexts 191,250 191,443 193 0.1%
Sema.NumTypesDeserialized 492,243 492,827 584 0.12%
Sema.NumTypesValidated 31,173 31,173 0 0.0%

Release

release brief

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (3)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 1,270,108,321,297 1,269,978,283,351 -130,037,946 -0.01%
LLVM.NumLLVMBytesOutput 56,793,536 56,793,656 120 0.0%
time.swift-driver.wall 133.7s 133.4s -259.1ms -0.19%

release detailed

Regressed (0)
name old new delta delta_pct
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (18)
name old new delta delta_pct
AST.NumLoadedModules 552 552 0 0.0%
AST.NumTotalClangImportedEntities 33,368 33,368 0 0.0%
IRModule.NumIRBasicBlocks 169,463 169,463 0 0.0%
IRModule.NumIRFunctions 77,865 77,865 0 0.0%
IRModule.NumIRGlobals 88,575 88,575 0 0.0%
IRModule.NumIRInsts 1,454,155 1,454,155 0 0.0%
IRModule.NumIRValueSymbols 155,615 155,615 0 0.0%
LLVM.NumLLVMBytesOutput 56,793,536 56,793,656 120 0.0%
SILModule.NumSILGenFunctions 28,956 28,956 0 0.0%
SILModule.NumSILOptFunctions 24,763 24,763 0 0.0%
Sema.NumConformancesDeserialized 79,161 79,161 0 0.0%
Sema.NumConstraintScopes 968,017 968,017 0 0.0%
Sema.NumDeclsDeserialized 198,541 198,541 0 0.0%
Sema.NumFunctionsTypechecked 10,984 10,984 0 0.0%
Sema.NumGenericSignatureBuilders 5,291 5,291 0 0.0%
Sema.NumLazyIterableDeclContexts 24,818 24,818 0 0.0%
Sema.NumTypesDeserialized 107,203 107,203 0 0.0%
Sema.NumTypesValidated 18,705 18,705 0 0.0%

@DougGregor DougGregor merged commit 3981a68 into swiftlang:master Feb 4, 2020
@DougGregor DougGregor deleted the function-builders-single-expr-closures-return branch February 4, 2020 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants