-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[semantic-arc-opts] Let the simple lifetime join optimization handle certain copies with forwarding insts. #34820
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 smoke benchmark |
@swift-ci test source compatibility |
Performance: -O
Code size: -OPerformance: -Osize
Code size: -OsizePerformance: -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
|
@swift-ci benchmark |
Thats some of the expected -Onone speedup since this optimization is really simple and also runs at -Onone. |
Performance: -O
Code size: -OPerformance: -Osize
Code size: -OsizePerformance: -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
|
@swift-ci benchmark |
Performance: -O
Code size: -OPerformance: -Osize
Code size: -OsizePerformance: -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
|
@swift-ci benchmark |
Performance: -O
Code size: -OPerformance: -Osize
Code size: -OsizePerformance: -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
|
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.
lgtm
…certain copies with forwarding insts. When I originally landed this optimization, I was trying to handle simple cases without forwarding instructions in my head. In my head, handling this with forwarding instructions meant using OwnershipLiveRange. Sadly, I didn't realize at the time that if I didn't use OwnershipLiveRange and just treated forwarding insts as normal lifetime ending instructions for owned values, everything just worked (since our check was where %5 in the following was any lifetime ending instruction for %4c. ``` %4 = copy_value %3 : $Builtin.NativeObject %4c = copy_value %4 : $Builtin.NativeObject destroy_value %4 : $Builtin.NativeObject %5 = enum $FakeOptional<Builtin.NativeObject>, #FakeOptional.some!enumelt, %4c : $Builtin.NativeObject ``` The optimization causes the above to simplified to: ``` %4 = copy_value %3 : $Builtin.NativeObject %5 = enum $FakeOptional<Builtin.NativeObject>, #FakeOptional.some!enumelt, %4 : $Builtin.NativeObject ``` Notice importantly that we are not shrinking the lifetime of %4, so we can do this safely without interior pointers being guarded with borrow scopes everywhere yet.
c0abd81
to
5a2d63d
Compare
@swift-ci smoke test |
@swift-ci smoke test OS X platform |
1 similar comment
@swift-ci smoke test OS X platform |
@swift-ci smoke test linux platform |
Just like, |
When I originally landed this optimization, I was trying to handle simple cases
without forwarding instructions in my head. In my head, handling this with
forwarding instructions meant using OwnershipLiveRange. Sadly, I didn't realize
at the time that if I didn't use OwnershipLiveRange and just treated forwarding
insts as normal lifetime ending instructions for owned values, everything just
worked (since our check was where %5 in the following was any lifetime ending
instruction for %4c.
The optimization causes the above to simplified to:
Notice importantly that we are not shrinking the lifetime of %4, so we can do
this safely without interior pointers being guarded with borrow scopes
everywhere yet.