-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Enable ArrayBoundsCheckElimination on OSSA #35380
Conversation
@swift-ci test |
@swift-ci benchmark |
@swift-ci test source compatibility |
Build failed |
@swift-ci test macOS Platform |
Performance: -O
Code size: -OPerformance: -Osize
Code size: -OsizePerformance: -OnoneCode 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.
I'm confused about replaceAllUsesWithUndef
but otherwise it looks good.
} | ||
auto *Copy = cast<CopyValueInst>(ArrayStructValue); | ||
auto Addr = cast<LoadInst>(Copy->getOperand())->getOperand(); | ||
Copy->replaceAllUsesWithUndef(); |
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.
I can't understand how replaceAllUsesWithUndef
works here. What about other uses of the array value? The call may take a guaranteed
self, or may be in a different block from the copy, no?
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.
Fixed it. Thanks!
} else { | ||
auto Self = getSelf(); | ||
assert(isa<CopyValueInst>(Self) || isa<LoadInst>(Self)); | ||
Self->replaceAllUsesWithUndef(); |
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.
Again I'm not sure how replaceAllUsesWithUndef
works in general. Is it assuming the call takes an owned self and is in the same blocks. Even then, what about other non-consuming uses of the array that aren't being rewritten?
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 for pointing it out. I fixed this and added a test.
- Updated free functions as class methods and avoid passing redundant args - Updated ReleaseSafeArrays to be a class member
a768c70
to
00ea81c
Compare
@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.
LGTM
Minor refactoring in ArrayBoundsCheckElimination
Support hoisting/copying owned/guaranteed self in ArraySemantics
Support OSSA instructions load [copy], copy_value, destroy_value in ArrayBoundsCheckElimination