-
Notifications
You must be signed in to change notification settings - Fork 219
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
Instruction::has_side_effects
and Instrinsic::has_side_effects
are not accurate.
#4237
Comments
I'm still unsure why has_side_effects is inaccurate after reading the description here.
I can see the argument for keeping the error in this case but I'm also alright with enabling more optimizations by keeping the behavior as-is. Unlike e.g. printing, retrieving an element from an array is primarily done to get the actual element rather than doing so to perform the bounds check.
I'm not sure what the motivation for a |
In this PR I'm attempting to maximise the number of instructions for which side effects are turned on for as this allows us to maximise the usage of constraint information in #4060. I'm then delaying any
Yeah, I get this point of view. It's only really an issue if you start messing about with |
I've done a little thinking on this and perhaps the issue is that we're overloading Might it be best to split this into |
@TomAFrench that sounds good to me. I'm all in favor of more specific names and splitting out different use cases from each other if needed. |
# Description ## Problem\* Resolves #4237 ## Summary\* I replace is_pure() and has_side_effect() by can_be_replaced() and can_eliminate_if_unused(), the former using requires_acir_gen_predicate() which indicates if the instructions will depend on the side_effect_enabled variable. ## Additional Context I did not renamed has_side_effect() for Intrinsic because I believe the name is accurate here. ## Documentation\* Check one: - [X] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [X] I have tested the changes locally. - [X] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
There's a number of
Instruction
s andIntrinsic
s which use theside_effects_enabled_var
variables in ACIR gen. This has a couple of knock-on-effects:remove_enable_side_effects
SSA pass #4224Instruction::EnableSideEffects
any of the following instructions before we hit the nextInstruction::EnableSideEffects
.The list that comes to mind of instructions/intrinsics which should
noir/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
Lines 756 to 757 in 0ffc38b
get_flattened_index
noir/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
Line 1849 in 0ffc38b
noir/compiler/noirc_evaluator/src/ssa/acir_gen/mod.rs
Line 1989 in 0ffc38b
The text was updated successfully, but these errors were encountered: