-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Use AccessPath in LICM and split loads for combine load/store hoisting #33987
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
e4e82d5
to
ee0ce56
Compare
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.
First step for my review: I'd like to fully understand how this should work. So I just reviewed the documentation for now. Once I have a clear picture, I continue with the implementation.
ee0ce56
to
715455f
Compare
@eeckstein documentation feedback was all very helpful. The rewritten documentation is here: Keep in mind, I'm keeping it as concise as I can since I think details belong in file or class level comments. This PR is only supposed to cover the LICM load splitting optimization. |
The LICM algorithm was not robust with respect to address projection because it identifies a projected address by its SILValue. This should never be done! Use AccessPath instead. Fixes regressions caused by rdar://66791257 (Print statement provokes "Can't unsafeBitCast between types of different sizes" when optimizations enabled)
715455f
to
c374029
Compare
@swift-ci test |
@swift-ci test source compatibility |
@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
|
Build failed |
c374029
to
dc660c5
Compare
For combined load-store hoisting, split loads that contain the loop-stored value into a single load from the same address as the loop-stores, and a set of loads disjoint from the loop-stores. The single load will be hoisted while sinking the stores to the same address. The disjoint loads will be hoisted normally in a subsequent iteration on the same loop. loop: load %outer store %inner1 exit: Will be split into loop: load %inner1 load %inner2 store %inner1 exit: Then, combined load/store hoisting will produce: load %inner1 loop: load %inner2 exit: store %inner1
dc660c5
to
437765e
Compare
I finished writing tests for corner cases and caught a potential miscompile. |
@swift-ci test |
@swift-ci test source compatibility |
Build failed |
I'm seeing a PR testing issue: libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: recursive_mutex lock failed: Invalid argument |
And another PR testing failure with the Debug SCK
|
@swift-ci smoke test OS X |
This seems to have failed to build on Windows, can we revert this? |
Still waiting to merge #33121
And creating more thorough test cases for this.
Fixes regressions caused by rdar://66791257 (Print statement provokes "Can't unsafeBitCast between types of different sizes" when optimizations enabled)
Step 1:
Use AccessPath in LICM.
Step 2:
LICM: split loads that are wider than the loop-stored value.