-
Notifications
You must be signed in to change notification settings - Fork 94
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
Codegen new intrinsic raw_eq
#331
Codegen new intrinsic raw_eq
#331
Conversation
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!
// TODO: Handle more cases in this intrinsic by looking into the parameters' layouts. | ||
// TODO: Fix soundness issues in this intrinsic. It's UB to call `raw_eq` if any of | ||
// the bytes in the first or second arguments are uninitialized. |
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.
Are there things we could assert
on here? Or for the first TODO would it already crash in the unhandled cases?
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.
The soundness check has to come in before the rest of the code. Then you can decide based on layouts and finally use memcmp
for the general case. The cranelift backend does this.
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.
👍
Description of changes:
This allows us to codegen the intrinsic
raw_eq
which has been introduced in the latest rebase. See #292 for the report.Resolved issues:
Resolves #330
Unblocks #292
Call-outs:
Codegen can be improved to avoid calling
memcmp
in some cases.Testing:
How is this change tested? Existing regression plus one new test for this intrinsic.
Is this a refactor change? No.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.