-
Notifications
You must be signed in to change notification settings - Fork 204
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
feat: std::hint::black_box
function.
#6529
base: master
Are you sure you want to change the base?
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.
Can you add some tests to check how it handles arrays, etc.?
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.
Good shout, the slice tests uncovered a bug.
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.
Added some tests with mutable references but that doesn't work very well. I left some comments about scenarios that didn't work out, let me know if you think there's anything we can do about them.
bfffb6f
to
d853070
Compare
d853070
to
9eb9c32
Compare
I'd like to take another look at this today after scrum |
…471-hint-blackbox
@TomAFrench have you had a chance to look at this? |
Description
Problem*
Resolves #6471
Summary*
Added a
std::hint
Noir module with ablack_box
builtin function that is treated during SSA optimisation steps as if it could potentially have side effects, which prevents the value it is applied to from being simplified to a known value and the instruction from being removed.Additional Context
Using a
builtin
rather thanforeign
so that this can be called from non-Brillig code.I added an
Intrinsic::Hint
becauseIntrinsic::BlackBox
was already taken; perhapsIntrinsic::AsWitness
could be moved intoHint
as well (not that it matters, but the comments call it a hint too).Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.