-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix SideEffectAnalysis for a function with defined @effects #38324
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 |
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.
This seems strictly better. I don't actually understand the original code though because it isn't well specified. Why isn't an @inout
considered a write of the argument?
We weren't looking at the parameter conventions that resulted in different side-effects than the defined @effects.
@swift-ci benchmark |
@atrick I pushed a version which handles param effects for different conventions. I am seeing some very bad benchmark scores locally, with a lot more retains/releases in the stdlib SIL. Going to do some more investigation before I merge this. |
Performance (x86_64): -O
Code size: -O
Performance (x86_64): -Osize
Code size: -OsizePerformance (x86_64): -Onone
Code size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
Per discussion, the minimal fix would be as follows:
We should not fix, but should comment that
|
Sources have changed considerably since I last looked at this. Documenting the issue in rdar://155870190 (SideEffects analysis can block optimizations in the presence of @effects) for now. |
… attribute. For the bug this patch aims to fix, we only need to compute the isDeinitBarrier property. We could attempt to only store the computed value of the isDeinitBarrier property, but there is no benefit to this over storing all the computed values. The benefit of the previous behaviour was avoiding the overhead of computing any properties in the first place. rdar://155870190 This aims to resolve the same problem as swiftlang#38324.
… attribute. For the bug this patch aims to fix, we only need to compute the isDeinitBarrier property. We could attempt to only store the computed value of the isDeinitBarrier property, but there is no benefit to this over storing all the computed values. The benefit of the previous behaviour was avoiding the overhead of computing any properties in the first place. rdar://155870190 This aims to resolve the same problem as swiftlang#38324.
… attribute. For the bug this patch aims to fix, we only need to compute the isDeinitBarrier property. We could attempt to only store the computed value of the isDeinitBarrier property, but there is no benefit to this over storing all the computed values. The benefit of the previous behaviour was avoiding the overhead of computing any properties in the first place. rdar://155870190 This aims to resolve the same problem as swiftlang#38324.
… attribute. This allows us to compute the deinit_barrier effect for such functions, fixing the test case here: rdar://155870190 This supercedes swiftlang#38324. ComputeSideEffects: Reformat tests to follow conventions Includes moving irrelevant tests out of side_effects.sil TempLValueElimination: deinit_barrier tests with effect attributes ComputeSideEffects: Combine defined+computed effects optimistically ComputeSideEffects: Store defined argumentEffects This uses the same logic as Function.getSideEffects to determine the argument effects of a function with an effectAttribute. ComputeSideEffects: tests for defined argument effects ComputeSideEffects: test defined effects overriding computed effects
… attribute. This allows us to compute the deinit_barrier effect for such functions, fixing the test case here: rdar://155870190 This supercedes swiftlang#38324. ComputeSideEffects: Reformat tests to follow conventions Includes moving irrelevant tests out of side_effects.sil TempLValueElimination: deinit_barrier tests with effect attributes ComputeSideEffects: Combine defined+computed effects optimistically ComputeSideEffects: Store defined argumentEffects This uses the same logic as Function.getSideEffects to determine the argument effects of a function with an effectAttribute. ComputeSideEffects: tests for defined argument effects ComputeSideEffects: test defined effects overriding computed effects
… attribute. This allows us to compute the deinit_barrier effect for such functions, fixing the test case here: rdar://155870190 This supercedes swiftlang#38324.
After computing side effects, we also remove any global or argument effects that are computed to happen, but are defined not to, based on the effect attribute. This allows us to compute the deinit_barrier effect for such functions, fixing the test case here: rdar://155870190 This supercedes swiftlang#38324.
We weren't looking at the parameter conventions that resulted in
different side-effects than the defined @effects.