-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[sil-combine] Use canonicalizeOSSALifetimes to eliminate unnecessary copies inserted due to RAUWing #37208
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
[sil-combine] Use canonicalizeOSSALifetimes to eliminate unnecessary copies inserted due to RAUWing #37208
Conversation
…erands to the worklist without deleting instructions. This is needed to allow for clients to compose InstModCallbacks with SILInstructionWorklist callbacks.
…deletion utility that I missed.
…mes around CanonicalizeOSSALifetime that clean up extra copies inserted when RAUWing or promoting loads. Based on code in CopyPropagation. It is assumed that the passed in set of defs is unique and that all such defs were found by using CanonicalizeOSSALifetime::getCanonicalCopiedDef(copy).
…n moving newly created instructions into the worklist. To be more explicit, canonicalizeOSSALifetimes is a utility that re-canonicalizes all at once a set of defs that the caller found by applying CanonicalizeOSSALifetime::getCanonicalCopiedDef(copy)). The reason why I am doing this is that when we RAUW in OSSA, we sometimes insert additional copies to make the problem easier for a utility to handle. This lets us canonicalize away any copies before we even leave the pass.
@swift-ci test |
@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 |
I am not expecting any benchmark changes. What I am trying to just do is teach individual passes that use the Ownership RAUW infrastructure how to use copy propagation to eliminate unnecessary copies by canonicalizing lifetimes. |
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
|
Regressions are different. Its most likely noise. |
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
// eliminate unnecessary copies introduced by RAUWing when ownership is | ||
// enabled. | ||
// | ||
// NOTE: It is ok if copy propagation results in MadeChanges being set to |
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.
Someone reading this comment won't realize that CanonicalizeOSSALifetime is mainly doing copy propagation.
This is the first in a series of patches that use canonicalizeOSSALifetimes to eliminate extra copies inserted. canonicalizeOSSALifetimes is a new helper that takes in a list of defs found via CanonicalizeOSSALifetime::getCanonicalCopiedDef(...) and canonicalizes them. I added it in SILCombine to canonicalize away any copies inserted due to us RAUWing values using the OwnershipRAUWHelper.
I am going to add it into other passes where we are creating new ownership calls (consider mem2reg). This will eliminate phase ordering issues in the compiler.