Skip to content

[ConstraintSystem] Delay constraint generation for single-statement closure body #28837

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
merged 27 commits into from
Jan 16, 2020

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Dec 17, 2019

Attempt to infer a closure type based on its parameters and body
and put it aside until contextual type becomes available or it
has been determined that there is no context.

Once all appropriate conditions are met, generate constraints for
the body of the closure and bind it the previously inferred type.

Doing so makes it possible to pass single-statement closures as
an argument to a function builder parameter.

Resolves: SR-11628
Resolves: rdar://problem/56340587

@xedin xedin requested review from DougGregor and hborla December 17, 2019 21:55
@xedin xedin marked this pull request as ready for review December 18, 2019 21:10
@xedin
Copy link
Contributor Author

xedin commented Dec 18, 2019

@swift-ci Please Build Toolchain macOS Platform

Copy link
Contributor

@hamishknight hamishknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getCalleeLocator changes look good to me!

@xedin xedin changed the title [ConstraintSystem] Delay constraint generation from single-statement closure body [ConstraintSystem] Delay constraint generation for single-statement closure body Dec 19, 2019
@xedin
Copy link
Contributor Author

xedin commented Dec 19, 2019

@swift-ci please test source compatibility

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Dec 19, 2019

@swift-ci please test source compatibility

TypeMatchOptions flags, ConstraintLocatorBuilder locator) {
closureType = getFixedTypeRecursive(closureType, flags, /*wantRValue=*/true);

if (closureType->isTypeVariableOrMember()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it makes sense to add hasTypeVariable() here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so because we really want to keep this constraint until the closure is resolved and the type it's bound to can (and probably would) have type variables. This constraint serves dual purpose - source of type for the closure when there is not contextual information available e.g. _ = { $0 + 1 } and to connect closure type variable to its inferred parameters and result type + any outer parameters used in the body until the closure is resolved. When closure type variable becomes bound to inferred type (closure is "resolved") everything becomes connected, so DefaultClosureType is obsolete from that moment on. I was thinking instead of DefaultCloureType to go with InferredClosureType, maybe that's a better name...

@xedin xedin force-pushed the rdar-56340587 branch 2 times, most recently from bdd00b7 to df0ffea Compare January 9, 2020 00:06
@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2020

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2020

@swift-ci please smoke test compiler performance

@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2020

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

swift-ci commented Jan 9, 2020

Summary for master smoketest

No regressions above thresholds

Debug

debug brief

Regressed (0)
name old new delta delta_pct
Improved (2)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 1,070,653,814,180 1,037,998,466,015 -32,655,348,165 -3.05% ✅
time.swift-driver.wall 86.7s 83.8s -3.0s -3.43% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (1)
name old new delta delta_pct
LLVM.NumLLVMBytesOutput 51,219,240 51,219,268 28 0.0%

debug detailed

Regressed (0)
name old new delta delta_pct
Improved (7)
name old new delta delta_pct
AST.NumTotalClangImportedEntities 167,355 165,636 -1,719 -1.03% ✅
Sema.NumConformancesDeserialized 198,870 189,543 -9,327 -4.69% ✅
Sema.NumConstraintScopes 1,044,088 986,005 -58,083 -5.56% ✅
Sema.NumDeclsDeserialized 1,578,777 1,507,882 -70,895 -4.49% ✅
Sema.NumGenericSignatureBuilders 27,688 27,287 -401 -1.45% ✅
Sema.NumLazyIterableDeclContexts 192,439 189,225 -3,214 -1.67% ✅
Sema.NumTypesDeserialized 495,119 484,272 -10,847 -2.19% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (11)
name old new delta delta_pct
AST.NumLoadedModules 6,089 6,089 0 0.0%
IRModule.NumIRBasicBlocks 188,586 188,586 0 0.0%
IRModule.NumIRFunctions 101,602 101,602 0 0.0%
IRModule.NumIRGlobals 110,556 110,556 0 0.0%
IRModule.NumIRInsts 2,100,091 2,100,091 0 0.0%
IRModule.NumIRValueSymbols 193,514 193,514 0 0.0%
LLVM.NumLLVMBytesOutput 51,219,240 51,219,268 28 0.0%
SILModule.NumSILGenFunctions 49,400 49,400 0 0.0%
SILModule.NumSILOptFunctions 67,887 67,887 0 0.0%
Sema.NumFunctionsTypechecked 10,984 10,984 0 0.0%
Sema.NumTypesValidated 31,169 31,169 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,462,751,282,003 1,458,378,507,374 -4,372,774,629 -0.3%
LLVM.NumLLVMBytesOutput 61,366,040 61,366,488 448 0.0%
time.swift-driver.wall 152.9s 151.7s -1.2s -0.79%

release detailed

Regressed (0)
name old new delta delta_pct
Improved (1)
name old new delta delta_pct
Sema.NumConstraintScopes 1,028,891 971,893 -56,998 -5.54% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (17)
name old new delta delta_pct
AST.NumLoadedModules 552 552 0 0.0%
AST.NumTotalClangImportedEntities 35,937 35,937 0 0.0%
IRModule.NumIRBasicBlocks 188,294 188,294 0 0.0%
IRModule.NumIRFunctions 80,706 80,706 0 0.0%
IRModule.NumIRGlobals 88,852 88,852 0 0.0%
IRModule.NumIRInsts 1,623,045 1,623,045 0 0.0%
IRModule.NumIRValueSymbols 158,825 158,825 0 0.0%
LLVM.NumLLVMBytesOutput 61,366,040 61,366,488 448 0.0%
SILModule.NumSILGenFunctions 28,959 28,959 0 0.0%
SILModule.NumSILOptFunctions 43,156 43,156 0 0.0%
Sema.NumConformancesDeserialized 82,479 82,479 0 0.0%
Sema.NumDeclsDeserialized 199,346 199,346 0 0.0%
Sema.NumFunctionsTypechecked 10,984 10,984 0 0.0%
Sema.NumGenericSignatureBuilders 5,337 5,337 0 0.0%
Sema.NumLazyIterableDeclContexts 24,915 24,915 0 0.0%
Sema.NumTypesDeserialized 111,026 111,026 0 0.0%
Sema.NumTypesValidated 18,705 18,705 0 0.0%

@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2020

@swift-ci please test compiler performance

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2020

@swift-ci please test compiler performance

@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2020

@swift-ci please test source compatibility debug

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2020

@swift-ci please test source compatibility debug

@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2020

@swift-ci please test source compatibility release

@swift-ci
Copy link
Contributor

swift-ci commented Jan 9, 2020

Summary for master full

Unexpected test results, excluded stats for RxCocoa, SwifterSwift, Base64CoderSwiftUI

Regressions found (see below)

Debug-batch

debug-batch 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 50,735,944,632,340 50,795,289,509,595 59,344,877,255 0.12%
LLVM.NumLLVMBytesOutput 1,801,003,806 1,801,002,116 -1,690 -0.0%
time.swift-driver.wall 5535.2s 5550.0s 14.9s 0.27%

debug-batch detailed

Regressed (4)
name old new delta delta_pct
Sema.DefaultTypeRequest 455,957 469,493 13,536 2.97% ⛔
Sema.NumConstraintScopes 27,680,259 28,584,971 904,712 3.27% ⛔
Sema.NumConstraintsConsideredForEdgeContraction 92,818,433 99,049,408 6,230,975 6.71% ⛔
Sema.NumLeafScopes 17,640,814 18,350,425 709,611 4.02% ⛔
Improved (5)
name old new delta delta_pct
Sema.AttachedFunctionBuilderRequest 3 1 -2 -66.67% ✅
Sema.CustomAttrNominalRequest 3 1 -2 -66.67% ✅
Sema.FunctionBuilderTypeRequest 3 1 -2 -66.67% ✅
Sema.HasDynamicMemberLookupAttributeRequest 711,396 655,716 -55,680 -7.83% ✅
Sema.NominalTypeLookupDirectCount 34,645,822 33,929,467 -716,355 -2.07% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (199)
name old new delta delta_pct
AST.ImportSetCacheHit 1,809,765 1,810,481 716 0.04%
AST.ImportSetCacheMiss 1,119,049 1,119,114 65 0.01%
AST.ImportSetFoldHit 650,138 650,139 1 0.0%
AST.ImportSetFoldMiss 468,911 468,975 64 0.01%
AST.ModuleShadowCacheHit 1,533,321 1,533,454 133 0.01%
AST.ModuleShadowCacheMiss 13,564 13,568 4 0.03%
AST.ModuleVisibilityCacheHit 33,149 33,149 0 0.0%
AST.ModuleVisibilityCacheMiss 8,458 8,458 0 0.0%
AST.NumASTBytesAllocated 64,154,612,182 64,160,754,765 6,142,583 0.01%
AST.NumASTScopeLookups 4,289,975 4,289,961 -14 -0.0%
AST.NumBraceStmtASTScopeExpansions 624,906 624,906 0 0.0%
AST.NumBraceStmtASTScopes 624,906 624,906 0 0.0%
AST.NumDecls 139,853 139,853 0 0.0%
AST.NumDependencies 429,068 429,074 6 0.0%
AST.NumInfixOperators 53,695 53,695 0 0.0%
AST.NumIterableTypeBodyASTScopeExpansions 271,595 271,591 -4 -0.0%
AST.NumIterableTypeBodyASTScopes 355,135 355,182 47 0.01%
AST.NumLinkLibraries 0 0 0 0.0%
AST.NumLoadedModules 404,163 404,163 0 0.0%
AST.NumLocalTypeDecls 250 250 0 0.0%
AST.NumModuleLookupClassMember 6,927 6,927 0 0.0%
AST.NumModuleLookupValue 48,539,717 48,559,495 19,778 0.04%
AST.NumObjCMethods 24,240 24,240 0 0.0%
AST.NumPostfixOperators 49 49 0 0.0%
AST.NumPrecedenceGroups 25,840 25,840 0 0.0%
AST.NumPrefixOperators 99 99 0 0.0%
AST.NumReferencedDynamicNames 189 189 0 0.0%
AST.NumReferencedMemberNames 6,309,732 6,309,750 18 0.0%
AST.NumReferencedTopLevelNames 476,243 476,243 0 0.0%
AST.NumSourceBuffers 602,301 602,301 0 0.0%
AST.NumSourceLines 4,717,684 4,717,684 0 0.0%
AST.NumSourceLinesPerSecond 3,238,508 3,233,568 -4,940 -0.15%
AST.NumTotalClangImportedEntities 6,193,322 6,199,926 6,604 0.11%
Driver.ChildrenMaxRSS 242,431,703,040 243,989,893,120 1,558,190,080 0.64%
Driver.DriverDepCascadingDynamic 0 0 0 0.0%
Driver.DriverDepCascadingExternal 0 0 0 0.0%
Driver.DriverDepCascadingMember 0 0 0 0.0%
Driver.DriverDepCascadingNominal 0 0 0 0.0%
Driver.DriverDepCascadingTopLevel 0 0 0 0.0%
Driver.DriverDepDynamic 0 0 0 0.0%
Driver.DriverDepExternal 0 0 0 0.0%
Driver.DriverDepMember 0 0 0 0.0%
Driver.DriverDepNominal 0 0 0 0.0%
Driver.DriverDepTopLevel 0 0 0 0.0%
Driver.NumDriverJobsRun 28,030 28,030 0 0.0%
Driver.NumDriverJobsSkipped 0 0 0 0.0%
Driver.NumDriverPipePolls 78,347 78,086 -261 -0.33%
Driver.NumDriverPipeReads 65,730 65,569 -161 -0.24%
Driver.NumProcessFailures 0 0 0 0.0%
Frontend.MaxMallocUsage 1,229,961,273,592 1,231,497,088,000 1,535,814,408 0.12%
Frontend.NumInstructionsExecuted 50,735,944,632,340 50,795,289,509,595 59,344,877,255 0.12%
Frontend.NumProcessFailures 0 0 0 0.0%
IRModule.NumIRAliases 196,319 196,319 0 0.0%
IRModule.NumIRBasicBlocks 6,863,346 6,863,345 -1 -0.0%
IRModule.NumIRComdatSymbols 0 0 0 0.0%
IRModule.NumIRFunctions 3,371,916 3,371,915 -1 -0.0%
IRModule.NumIRGlobals 3,682,366 3,682,366 0 0.0%
IRModule.NumIRIFuncs 0 0 0 0.0%
IRModule.NumIRInsts 87,970,348 87,970,353 5 0.0%
IRModule.NumIRNamedMetaData 135,380 135,380 0 0.0%
IRModule.NumIRValueSymbols 6,399,165 6,399,164 -1 -0.0%
LLVM.NumLLVMBytesOutput 1,801,003,806 1,801,002,116 -1,690 -0.0%
Parse.NumFunctionsParsed 268,976 268,976 0 0.0%
Parse.NumIterableDeclContextParsed 939,427 939,445 18 0.0%
Parse.ParseAbstractFunctionBodyRequest 246,370 246,370 0 0.0%
Parse.ParseMembersRequest 770,803 770,821 18 0.0%
SILModule.NumSILGenDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILGenFunctions 1,701,394 1,701,393 -1 -0.0%
SILModule.NumSILGenGlobalVariables 53,554 53,554 0 0.0%
SILModule.NumSILGenVtables 18,627 18,627 0 0.0%
SILModule.NumSILGenWitnessTables 72,395 72,395 0 0.0%
SILModule.NumSILOptDefaultWitnessTables 0 0 0 0.0%
SILModule.NumSILOptFunctions 2,523,223 2,523,222 -1 -0.0%
SILModule.NumSILOptGlobalVariables 55,187 55,187 0 0.0%
SILModule.NumSILOptVtables 31,428 31,428 0 0.0%
SILModule.NumSILOptWitnessTables 169,304 169,304 0 0.0%
Sema.AbstractGenericSignatureRequest 34,854 34,854 0 0.0%
Sema.AccessLevelRequest 12,288,598 12,309,406 20,808 0.17%
Sema.AnyObjectLookupRequest 281 281 0 0.0%
Sema.AreAllStoredPropertiesDefaultInitableRequest 23,241 23,241 0 0.0%
Sema.AttachedPropertyWrapperTypeRequest 540,381 540,381 0 0.0%
Sema.AttachedPropertyWrappersRequest 2,374,808 2,369,528 -5,280 -0.22%
Sema.CallerSideDefaultArgExprRequest 78,637 78,637 0 0.0%
Sema.ClassAncestryFlagsRequest 111,574 111,574 0 0.0%
Sema.CollectOverriddenDeclsRequest 7,301,979 7,339,449 37,470 0.51%
Sema.CompareDeclSpecializationRequest 471,221 472,307 1,086 0.23%
Sema.CursorInfoRequest 0 0 0 0.0%
Sema.DefaultAndMaxAccessLevelRequest 58,486 58,484 -2 -0.0%
Sema.DefaultArgumentExprRequest 38,177 38,177 0 0.0%
Sema.DefaultArgumentInitContextRequest 454 454 0 0.0%
Sema.DefaultDefinitionTypeRequest 8,214 8,214 0 0.0%
Sema.DynamicallyReplacedDeclRequest 1,069,474 1,069,474 0 0.0%
Sema.EmittedMembersRequest 27,960 27,960 0 0.0%
Sema.EnumRawTypeRequest 25,725 25,725 0 0.0%
Sema.EnumRawValuesRequest 10,587 10,587 0 0.0%
Sema.ExistentialConformsToSelfRequest 14,515 14,495 -20 -0.14%
Sema.ExistentialTypeSupportedRequest 17,897 17,897 0 0.0%
Sema.ExpandASTScopeRequest 7,675,216 7,675,262 46 0.0%
Sema.ExtendedNominalRequest 916,704 916,704 0 0.0%
Sema.ExtendedTypeRequest 83,502 83,503 1 0.0%
Sema.FunctionOperatorRequest 73,361 73,361 0 0.0%
Sema.GenericParamListRequest 12,773,752 12,792,784 19,032 0.15%
Sema.GenericSignatureRequest 5,653,763 5,657,633 3,870 0.07%
Sema.GetDestructorRequest 28,229 28,229 0 0.0%
Sema.HasCircularInheritanceRequest 23,920 23,920 0 0.0%
Sema.HasCircularInheritedProtocolsRequest 10,224 10,224 0 0.0%
Sema.HasCircularRawValueRequest 8,958 8,958 0 0.0%
Sema.HasDefaultInitRequest 56,884 56,884 0 0.0%
Sema.HasMemberwiseInitRequest 20,394 20,394 0 0.0%
Sema.HasMissingDesignatedInitializersRequest 26,847 26,847 0 0.0%
Sema.HasUserDefinedDesignatedInitRequest 56,894 56,894 0 0.0%
Sema.InferredGenericSignatureRequest 189,637 189,631 -6 -0.0%
Sema.InheritedDeclsReferencedRequest 6,921,827 6,937,355 15,528 0.22%
Sema.InheritedTypeRequest 314,982 315,230 248 0.08%
Sema.InheritsSuperclassInitializersRequest 30,032 30,032 0 0.0%
Sema.InitKindRequest 98,033 98,033 0 0.0%
Sema.InterfaceTypeRequest 16,943,610 17,042,313 98,703 0.58%
Sema.IsABICompatibleOverrideRequest 136,210 136,210 0 0.0%
Sema.IsAccessorTransparentRequest 319,462 319,462 0 0.0%
Sema.IsCallableNominalTypeRequest 2,089 2,077 -12 -0.57%
Sema.IsDeclApplicableRequest 0 0 0 0.0%
Sema.IsDynamicRequest 1,753,080 1,753,080 0 0.0%
Sema.IsFinalRequest 2,664,553 2,669,076 4,523 0.17%
Sema.IsGetterMutatingRequest 434,466 434,466 0 0.0%
Sema.IsImplicitlyUnwrappedOptionalRequest 2,527,177 2,528,198 1,021 0.04%
Sema.IsObjCRequest 1,597,967 1,597,959 -8 -0.0%
Sema.IsSetterMutatingRequest 342,898 342,898 0 0.0%
Sema.IsStaticRequest 3,727,956 3,728,797 841 0.02%
Sema.LazyStoragePropertyRequest 2,516 2,516 0 0.0%
Sema.LookupInModuleRequest 6,822,166 6,838,354 16,188 0.24%
Sema.LookupPrecedenceGroupRequest 175,955 175,955 0 0.0%
Sema.MangleLocalTypeDeclRequest 500 500 0 0.0%
Sema.ModuleQualifiedLookupRequest 3,008,551 3,024,748 16,197 0.54%
Sema.NamedLazyMemberLoadFailureCount 17,589 17,602 13 0.07%
Sema.NamedLazyMemberLoadSuccessCount 12,878,045 12,883,693 5,648 0.04%
Sema.NamingPatternRequest 207,683 207,681 -2 -0.0%
Sema.NeedsNewVTableEntryRequest 696,060 696,060 0 0.0%
Sema.NumAccessorBodiesSynthesized 189,152 189,152 0 0.0%
Sema.NumAccessorsSynthesized 295,089 295,089 0 0.0%
Sema.NumConformancesDeserialized 9,681,261 9,694,516 13,255 0.14%
Sema.NumCyclicOneWayComponentsCollapsed 0 0 0 0.0%
Sema.NumDeclsDeserialized 77,129,196 77,250,635 121,439 0.16%
Sema.NumDeclsTypechecked 1,412,011 1,412,011 0 0.0%
Sema.NumFunctionsTypechecked 529,260 529,260 0 0.0%
Sema.NumGenericSignatureBuilders 1,461,916 1,462,470 554 0.04%
Sema.NumLazyIterableDeclContexts 9,810,836 9,817,742 6,906 0.07%
Sema.NumLazyRequirementSignatures 1,043,372 1,043,376 4 0.0%
Sema.NumLazyRequirementSignaturesLoaded 753,026 753,117 91 0.01%
Sema.NumTypesDeserialized 23,728,092 23,745,888 17,796 0.07%
Sema.NumTypesValidated 1,526,789 1,526,784 -5 -0.0%
Sema.NumUnloadedLazyIterableDeclContexts 6,300,321 6,303,660 3,339 0.05%
Sema.OpaqueReadOwnershipRequest 282,056 282,056 0 0.0%
Sema.OpaqueResultTypeRequest 0 0 0 0.0%
Sema.OperatorPrecedenceGroupRequest 747 747 0 0.0%
Sema.OverriddenDeclsRequest 3,041,699 3,044,777 3,078 0.1%
Sema.ParamSpecifierRequest 1,309,284 1,309,283 -1 -0.0%
Sema.PatternBindingEntryRequest 464,937 464,935 -2 -0.0%
Sema.PatternTypeRequest 586,252 586,250 -2 -0.0%
Sema.PreCheckFunctionBuilderRequest 0 0 0 0.0%
Sema.PropertyWrapperBackingPropertyInfoRequest 535,004 535,004 0 0.0%
Sema.PropertyWrapperBackingPropertyTypeRequest 540,381 540,381 0 0.0%
Sema.PropertyWrapperMutabilityRequest 630,613 630,613 0 0.0%
Sema.PropertyWrapperTypeInfoRequest 1 1 0 0.0%
Sema.ProtocolRequiresClassRequest 76,517 76,756 239 0.31%
Sema.ProvideDefaultImplForRequest 7,301,979 7,339,449 37,470 0.51%
Sema.QualifiedLookupRequest 7,361,933 7,331,325 -30,608 -0.42%
Sema.RangeInfoRequest 0 0 0 0.0%
Sema.RequirementRequest 113,866 113,865 -1 -0.0%
Sema.RequirementSignatureRequest 832,814 833,174 360 0.04%
Sema.RequiresOpaqueAccessorsRequest 1,314,548 1,314,548 0 0.0%
Sema.RequiresOpaqueModifyCoroutineRequest 273,195 273,195 0 0.0%
Sema.ResilienceExpansionRequest 1,865,573 1,865,573 0 0.0%
Sema.ResolveImplicitMemberRequest 372,666 372,719 53 0.01%
Sema.ResolveProtocolNameRequest 0 0 0 0.0%
Sema.ResultTypeRequest 695,565 695,561 -4 -0.0%
Sema.RootAndResultTypeOfKeypathDynamicMemberRequest 0 0 0 0.0%
Sema.RootTypeOfKeypathDynamicMemberRequest 0 0 0 0.0%
Sema.SelfAccessKindRequest 3,174,563 3,176,200 1,637 0.05%
Sema.SelfBoundsFromWhereClauseRequest 1,813,205 1,819,439 6,234 0.34%
Sema.SetterAccessLevelRequest 145,111 145,111 0 0.0%
Sema.StorageImplInfoRequest 1,423,621 1,423,621 0 0.0%
Sema.StoredPropertiesAndMissingMembersRequest 32,428 32,428 0 0.0%
Sema.StoredPropertiesRequest 369,964 369,964 0 0.0%
Sema.StructuralTypeRequest 2,318 2,318 0 0.0%
Sema.SuperclassDeclRequest 501,017 501,167 150 0.03%
Sema.SuperclassTypeRequest 60,087 60,087 0 0.0%
Sema.SynthesizeAccessorRequest 295,089 295,089 0 0.0%
Sema.SynthesizeDefaultInitRequest 5,394 5,394 0 0.0%
Sema.SynthesizeMemberwiseInitRequest 3,199 3,199 0 0.0%
Sema.TypeCheckFunctionBodyUntilRequest 529,260 529,260 0 0.0%
Sema.TypeCheckSourceFileRequest 27,076 27,076 0 0.0%
Sema.TypeDeclsFromWhereClauseRequest 30,488 30,486 -2 -0.01%
Sema.TypeRelationCheckRequest 0 0 0 0.0%
Sema.TypeWitnessRequest 9,281 9,279 -2 -0.02%
Sema.USRGenerationRequest 8,699,108 8,743,201 44,093 0.51%
Sema.UnderlyingTypeDeclsReferencedRequest 382,367 382,817 450 0.12%
Sema.UnderlyingTypeRequest 38,660 38,660 0 0.0%
Sema.UnqualifiedLookupRequest 4,434,794 4,434,780 -14 -0.0%
Sema.ValueWitnessRequest 68,677 68,677 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 51,252,996,684,755 51,331,023,689,070 78,027,004,315 0.15%
LLVM.NumLLVMBytesOutput 1,926,359,148 1,926,360,348 1,200 0.0%
time.swift-driver.wall 9493.3s 9536.8s 43.6s 0.46%

release detailed

Regressed (1)
name old new delta delta_pct
Sema.NumConstraintScopes 27,313,772 28,221,067 907,295 3.32% ⛔
Improved (0)
name old new delta delta_pct
Unchanged (delta < 1.0% or delta < 100.0ms) (17)
name old new delta delta_pct
AST.NumLoadedModules 30,053 30,053 0 0.0%
AST.NumTotalClangImportedEntities 1,182,860 1,181,714 -1,146 -0.1%
IRModule.NumIRBasicBlocks 5,447,970 5,447,970 0 0.0%
IRModule.NumIRFunctions 2,833,661 2,833,661 0 0.0%
IRModule.NumIRGlobals 3,193,845 3,193,845 0 0.0%
IRModule.NumIRInsts 53,509,026 53,509,037 11 0.0%
IRModule.NumIRValueSymbols 5,670,071 5,670,071 0 0.0%
LLVM.NumLLVMBytesOutput 1,926,359,148 1,926,360,348 1,200 0.0%
SILModule.NumSILGenFunctions 1,189,997 1,189,996 -1 -0.0%
SILModule.NumSILOptFunctions 1,733,021 1,733,020 -1 -0.0%
Sema.NumConformancesDeserialized 3,645,246 3,645,519 273 0.01%
Sema.NumDeclsDeserialized 10,696,141 10,696,189 48 0.0%
Sema.NumFunctionsTypechecked 532,882 532,882 0 0.0%
Sema.NumGenericSignatureBuilders 281,445 281,439 -6 -0.0%
Sema.NumLazyIterableDeclContexts 1,318,546 1,318,600 54 0.0%
Sema.NumTypesDeserialized 5,413,853 5,413,862 9 0.0%
Sema.NumTypesValidated 826,777 826,777 0 0.0%

@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2020

I'm not sure why but some of the builds where UPASS which I think contributed to the difference in number of constraint scopes, but I think that's okay because it didn't contribute to build time...

@xedin
Copy link
Contributor Author

xedin commented Jan 11, 2020

@DougGregor @hborla This is ready for a final review. I'm going to run CI meanwhile.

@xedin
Copy link
Contributor Author

xedin commented Jan 11, 2020

@swift-ci please test

xedin added 7 commits January 14, 2020 00:09
…or ranking

Instead of trying to hold a "global" set of type variable differences
let's use pair-wise comparison instead because in presence of generic
overloads such would be more precise.

If there are N solutions for a single generic overload we currently
relied on "local" comparison to detect the difference, but it's not
always possible to split the system to do one. Which means higher
level comparisons have to account for "local" (per overload choice)
differences as well otherwise ranking would loose precision.
…member overloads

Single type of keypath dynamic member lookup could refer to different
member overlaods, we have to do a pair-wise comparison in such cases
otherwise ranking would miss some viable information e.g.
`_ = arr[0..<3]` could refer to subscript through writable or read-only
key path and each of them could also pick overload which returns `Slice<T>`
or `ArraySlice<T>` (assuming that `arr` is something like `Box<[Int]>`).
…r (supertypes first)

If there is a subtype relationship between N types we have to make
sure that type chain is attempted in reverse order because we can't
infer bindings transitively through type variables and attempting
it in any other way would miss potential bindings across the chain.
@xedin
Copy link
Contributor Author

xedin commented Jan 14, 2020

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jan 14, 2020

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Jan 14, 2020

@swift-ci please smoke test compiler performance

@swift-ci
Copy link
Contributor

Summary for master smoketest

No regressions above thresholds

Debug

debug brief

Regressed (0)
name old new delta delta_pct
Improved (2)
name old new delta delta_pct
Frontend.NumInstructionsExecuted 1,000,141,092,429 885,563,119,041 -114,577,973,388 -11.46% ✅
time.swift-driver.wall 105.5s 98.0s -7.4s -7.05% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (1)
name old new delta delta_pct
LLVM.NumLLVMBytesOutput 50,839,108 50,839,088 -20 -0.0%

debug detailed

Regressed (0)
name old new delta delta_pct
Improved (7)
name old new delta delta_pct
AST.NumTotalClangImportedEntities 186,902 181,418 -5,484 -2.93% ✅
Sema.NumConformancesDeserialized 203,428 162,546 -40,882 -20.1% ✅
Sema.NumConstraintScopes 1,043,502 981,421 -62,081 -5.95% ✅
Sema.NumDeclsDeserialized 1,659,294 1,369,150 -290,144 -17.49% ✅
Sema.NumGenericSignatureBuilders 29,277 26,216 -3,061 -10.46% ✅
Sema.NumLazyIterableDeclContexts 215,271 202,371 -12,900 -5.99% ✅
Sema.NumTypesDeserialized 525,529 467,553 -57,976 -11.03% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (11)
name old new delta delta_pct
AST.NumLoadedModules 7,360 7,360 0 0.0%
IRModule.NumIRBasicBlocks 188,586 188,586 0 0.0%
IRModule.NumIRFunctions 101,423 101,423 0 0.0%
IRModule.NumIRGlobals 109,887 109,887 0 0.0%
IRModule.NumIRInsts 2,076,376 2,076,376 0 0.0%
IRModule.NumIRValueSymbols 192,666 192,666 0 0.0%
LLVM.NumLLVMBytesOutput 50,839,108 50,839,088 -20 -0.0%
SILModule.NumSILGenFunctions 49,400 49,400 0 0.0%
SILModule.NumSILOptFunctions 67,887 67,887 0 0.0%
Sema.NumFunctionsTypechecked 10,984 10,984 0 0.0%
Sema.NumTypesValidated 32,125 32,125 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,334,251,775,201 1,330,730,221,672 -3,521,553,529 -0.26%
LLVM.NumLLVMBytesOutput 58,736,432 58,735,764 -668 -0.0%
time.swift-driver.wall 196.5s 196.4s -92.8ms -0.05%

release detailed

Regressed (0)
name old new delta delta_pct
Improved (1)
name old new delta delta_pct
Sema.NumConstraintScopes 1,028,891 971,705 -57,186 -5.56% ✅
Unchanged (delta < 1.0% or delta < 100.0ms) (17)
name old new delta delta_pct
AST.NumLoadedModules 552 552 0 0.0%
AST.NumTotalClangImportedEntities 33,336 33,336 0 0.0%
IRModule.NumIRBasicBlocks 177,450 177,450 0 0.0%
IRModule.NumIRFunctions 78,154 78,154 0 0.0%
IRModule.NumIRGlobals 88,141 88,141 0 0.0%
IRModule.NumIRInsts 1,531,942 1,531,942 0 0.0%
IRModule.NumIRValueSymbols 155,578 155,578 0 0.0%
LLVM.NumLLVMBytesOutput 58,736,432 58,735,764 -668 -0.0%
SILModule.NumSILGenFunctions 28,959 28,959 0 0.0%
SILModule.NumSILOptFunctions 40,350 40,350 0 0.0%
Sema.NumConformancesDeserialized 79,389 79,389 0 0.0%
Sema.NumDeclsDeserialized 198,412 198,412 0 0.0%
Sema.NumFunctionsTypechecked 10,984 10,984 0 0.0%
Sema.NumGenericSignatureBuilders 5,295 5,295 0 0.0%
Sema.NumLazyIterableDeclContexts 24,811 24,811 0 0.0%
Sema.NumTypesDeserialized 107,091 107,091 0 0.0%
Sema.NumTypesValidated 18,705 18,705 0 0.0%

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!

}

ConstraintSystem &getConstraintSystem() const { return CS; }

void enterClosure(ClosureExpr *closure) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love that this goes away!

@xedin
Copy link
Contributor Author

xedin commented Jan 15, 2020

@swift-ci please smoke test

@xedin
Copy link
Contributor Author

xedin commented Jan 15, 2020

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jan 15, 2020

@swift-ci please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - c6a5f59

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - c6a5f59

Both multi- and single-statement closures now behave the same way
when it comes to constraint generation, because the body is opened
only once contextual type becomes available or it's impossible
to find one e.g. `_ = { 1 }`.
@xedin
Copy link
Contributor Author

xedin commented Jan 15, 2020

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jan 15, 2020

@swift-ci please test source compatibility

@swiftlang swiftlang deleted a comment from swift-ci Jan 15, 2020
@swiftlang swiftlang deleted a comment from swift-ci Jan 15, 2020
@xedin
Copy link
Contributor Author

xedin commented Jan 16, 2020

Alright, here we go :)

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.

5 participants