-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix infinite recursion in ClosureSpecialize #61956
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
Conversation
@swift-ci test |
@swift-ci benchmark |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically LGTM.
Can you add a test case?
2301aed
to
856386c
Compare
Fixes getSpecializationLevelRecursive to handle recursive manglings caused by interleaving CapturePropagation and ClosureSpecialize passes. For some reason, only the first closure parameter was checked for recursion. We need to handle patterns like this: kind=FunctionSignatureSpecialization kind=SpecializationPassID, index=3 kind=FunctionSignatureSpecializationParam kind=FunctionSignatureSpecializationParam kind=FunctionSignatureSpecializationParamKind, index=0 kind=FunctionSignatureSpecializationParamPayload, text="$s4test10ExpressionO8contains5whereS3bXE_tFSbACXEfU_S2bXEfU_36$s4test12IndirectEnumVACycfcS2bXEfU_Tf3npf_n" I fixed the logic so we now check for recursion on all closure parameters and bail out on unrecognized mangling formats. For reference, see summary.sil in Infinitely recursive closure specialization swiftlang#61955 swiftlang#61955 Fixes rdar://101589190 (Swift Compiler hangs when building this code for release)
856386c
to
c665311
Compare
Test case included |
@swift-ci smoke test and merge |
No benchmark regressions! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
@swift-ci smoke test macOS |
@swift-ci smoke test |
Fixes getSpecializationLevelRecursive to handle recursive manglings caused by interleaving CapturePropagation and ClosureSpecialize passes.
For some reason, only the first closure parameter was checked for recursion. We need to handle patterns like this:
kind=FunctionSignatureSpecialization
kind=SpecializationPassID, index=3
kind=FunctionSignatureSpecializationParam
kind=FunctionSignatureSpecializationParam
kind=FunctionSignatureSpecializationParamKind, index=0
kind=FunctionSignatureSpecializationParamPayload, text="$s4test10ExpressionO8contains5whereS3bXE_tFSbACXEfU_S2bXEfU_36$s4test12IndirectEnumVACycfcS2bXEfU_Tf3npf_n"
I fixed the logic so we now check for recursion on all closure parameters and bail out on unrecognized mangling formats.
For reference, see summary.sil in
Infinitely recursive closure specialization #61955 #61955
Fixes rdar://101589190 (Swift Compiler hangs when building this code for release)