fix(ssa): Start with checked operations in index calculations#9888
fix(ssa): Start with checked operations in index calculations#9888
Conversation
Changes to circuit sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Opcode count'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.10.
| Benchmark suite | Current: 591a433 | Previous: dd83075 | Ratio |
|---|---|---|---|
private-kernel-reset |
76858 opcodes |
68870 opcodes |
1.12 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Execution Memory'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: f631245 | Previous: 13fbc6f | Ratio |
|---|---|---|---|
rollup-base-private |
1360 MB |
506.72 MB |
2.68 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
|
Here's a minimised version of on of the failing tests: fn main() {
let b = unsafe { func_3() };
if b {
let c = unsafe { func_4() }[1532016929_u32].3;
if c {
let d = unsafe { func_3() };
}
}
}
unconstrained fn func_3() -> bool {
true
}
unconstrained fn func_4() -> [(str<3>, str<3>, bool, bool); 4] {
[
("ABC", "CDE", false, true),
("FGH", "IJK", false, true),
("LMN", "OPQ", false, true),
("RST", "UVW", false, true),
]
}It seems to fail trying to simplify the The problem seems to be that Original failure came from |
|
Here's what goes down. Before ...
enable_side_effects v1
v3 = call f2() -> [([u8; 3], [u8; 3], u1, u1); 4]
v6 = mul u32 1532016929, u32 4
v8 = add v6, u32 1
v10 = add v6, u32 2
v12 = add v6, u32 3
v13 = array_get v3, index v12 -> u1
v14 = unchecked_mul v1, v13
...The When it comes to inspect |
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: 591a433 | Previous: dd83075 | Ratio |
|---|---|---|---|
test_report_zkpassport_noir-ecdsa_ |
3 s |
1 s |
3 |
test_report_zkpassport_noir_rsa_ |
2 s |
1 s |
2 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
6292aff to
3b503eb
Compare
3b503eb to
88bf74a
Compare
Changes to number of Brillig opcodes executed
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
Changes to Brillig bytecode sizes
🧾 Summary (10% most significant diffs)
Full diff report 👇
|
|
Done. Here's the follow up ticket: #9930 |
Interesting, generalizing the check caused some failures. Looking at https://github.com/noir-lang/noir/actions/runs/17862409749/job/50796809412?pr=9888 these look to all be related to different inline types (e.g., calls ACIR/Brillig entry points and no predicates). |
|
Okay, this is great, it gives me examples to demonstrate why it's not safe to replace everything with defaults when we go under One of the failures is Here's is the SSA at various stages. After flattening: acir(inline) predicate_pure fn main f0 {
b0(v8: [u16; 3], v9: [u1; 1]):
v11 = call f1() -> [u1; 1]
v13 = array_get v11, index u32 0 -> u1
enable_side_effects v13
v14 = call f1() -> [u1; 1]
v15 = array_get v9, index u32 0 -> u1
v16 = not v13
enable_side_effects v16
v17 = array_get v8, index u32 0 -> u16
v18 = cast v17 as u32
v20 = mod v18, u32 3
v21 = array_get v8, index v20 -> u16
v22 = cast v21 as u32
v24 = lt u32 24993, v22
enable_side_effects u1 1
v26 = unchecked_mul v13, v15
v27 = unchecked_mul v16, v24
v28 = unchecked_add v26, v27
return v28
}After EnableSideEffectsIf removal: acir(inline) predicate_pure fn main f0 {
b0(v8: [u16; 3], v9: [u1; 1]):
v11 = call f1() -> [u1; 1]
v13 = array_get v11, index u32 0 -> u1
enable_side_effects v13
v14 = call f1() -> [u1; 1]
v15 = array_get v9, index u32 0 -> u1
v16 = not v13
v17 = array_get v8, index u32 0 -> u16
v18 = cast v17 as u32
enable_side_effects v16
v20 = mod v18, u32 3
v21 = array_get v8, index v20 -> u16
v22 = cast v21 as u32
v24 = lt u32 24993, v22
enable_side_effects u1 1
v26 = unchecked_mul v13, v15
v27 = unchecked_mul v16, v24
v28 = unchecked_add v26, v27
return v28
}Notice how the After inlining brillig calls: acir(inline) predicate_pure fn main f0 {
b0(v8: [u16; 3], v9: [u1; 1]):
v11 = make_array [u1 0] : [u1; 1]
enable_side_effects u1 0
v12 = make_array [u1 0] : [u1; 1]
v14 = array_get v9, index u32 0 -> u1
v15 = array_get v8, index u32 0 -> u16
v16 = cast v15 as u32
enable_side_effects u1 1
v19 = mod v16, u32 3
v20 = array_get v8, index v19 -> u16
v21 = cast v20 as u32
v23 = lt u32 24993, v21
enable_side_effects u1 1
return v23
}Now we have constants for At some point I added logic to However if we expand this to replace all instructions, then it includes the But if we remove that, then So: something that should not have been under |
Could we not potentially run into the same issue even when gating for a zero index? Is it fine because we assume we do not have mismatched SSA types in our SSA input? I guess this is a fine assumption if we validate our SSA for this. Makes sense, thank you for the detailed explanation. We handle something similar in ACIR gen. When we have an instruction which is not dependent on the predicate we use a predicate of one. This guarantees we get the value that was meant to be there rather than a default value noir/compiler/noirc_evaluator/src/acir/mod.rs Line 422 in 44b6be7 I see we have the same fall back inside of should_replace_instruction_with_defaults.
|
I was thinking about this yesterday: when we see an ArrayGet with index 0, can we be sure that it returns the right data, considering that it could have migrated between side effect variables? I think the answer is yes, because if we had a non-empty array, then index 0 was safe to begin with and we had no reason to tamper with it, so there should not be any inconsistency in the types. If it turns out that we did have to set the index to a default value, but the types still check out, then it's okay to leave it as it is, because it will read data that fits the shape, but most likely the circuit will fail before this comes to pass.
Yes, the assumption is that this type inconsistency can only be the product of this pass, and that it should be a temporary phenomenon that we must eliminate by the end of it. One thing I wondered about was that the elimination is gated by whether we are in the enable_side_effects v1
constraint v1 == 0 // This activates the UnreachableUnderPreciate mode
v3 = <load-index-from-memory> // Some side effecting operation, replaced by default, so v3 will be 0
enable_side_effects (v1*v2) // If `v1` was off, this will be off, yet we are back to being `Reachable`
v4 = array_get v0, index v3 -> u1 // the data at 0 might not be a u1 any more, and we are not removing because we are ReachableThe reason I thought this will not pose a problem in practice, is that where we get in trouble is with composite types, such as |
Something similar to the |
vezenovm
left a comment
There was a problem hiding this comment.
Approving as to get the fix in but I want to follow-up with #9888 (comment) and Change the SSA interpreter handling of overflows
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: print ACIR AssertZero as an equation (noir-lang/noir#9970) chore(acir): Switch to inline SSA for slice intrinsics tests (noir-lang/noir#10000) fix(fuzz): Handle divisor of zero msg in error comparison (noir-lang/noir#9995) fix(ssa): Handle OOB indexing of slice literals in `remove_unreachalbe_instructions` (noir-lang/noir#9999) chore: Add `DataFlowGraph::instruction_result` for getting a known number of results (noir-lang/noir#9989) chore(ast_fuzzer): Allow passing compilation options to cvise tool (noir-lang/noir#9996) chore(ssa_gen): Do not generate out of bounds checks for array assignments in ACIR (noir-lang/noir#9992) chore: add more to/from le/be bits/bytes edge case tests (noir-lang/noir#9906) fix: Disable early mem2reg (noir-lang/noir#9987) chore(ci): free up space on github runner (noir-lang/noir#9994) chore(ssa): Nits in `remove_bit_shift` and `remove_if_else` (noir-lang/noir#9965) chore(ssa_executor): add compilation example (noir-lang/noir#9937) chore(acir): More arrays refactors (noir-lang/noir#9962) chore(test): add panicking tests for 'defunctionalize' (noir-lang/noir#8510) chore: remove_if_else docs and refactors (noir-lang/noir#9929) chore(acir): Do not copy element type sizes array when initializing (noir-lang/noir#9955) fix: correct max_bit_size when left-shifting (noir-lang/noir#9770) chore: checked_to_unchecked enhancements from audit review (noir-lang/noir#9958) chore(ssa): Remove `offset` from `ArrayGet` and `ArraySet` (noir-lang/noir#9956) chore(acir): Add some unit tests for arrays and light refactors (noir-lang/noir#9953) chore: add regression test for #9852 (noir-lang/noir#9960) chore(fuzz): Add error equivalency for bit-shift overflow in the SSA interpreter (noir-lang/noir#9957) feat(cli): Visualize the Control Flow Graph (noir-lang/noir#9867) chore: minor constant_folding refactors (noir-lang/noir#9954) chore!: several ACIR serialisation changes (noir-lang/noir#8134) chore(ci): only send slack notifications during the week (noir-lang/noir#9946) chore: assumes no load-store in array_set (noir-lang/noir#9940) chore(acir): Arrays module doc comments (noir-lang/noir#9947) fix: correctly handle unusual radices in `ToRadix` decompositions (noir-lang/noir#9941) fix(ssa): Start with checked operations in index calculations (noir-lang/noir#9888) feat: no need to use dummy slice values in remove_if_else (noir-lang/noir#9928) chore: bump external pinned commits (noir-lang/noir#9938) chore: redo typo PR by viktorking7 (noir-lang/noir#9939) chore: Release Noir(1.0.0-beta.13) (noir-lang/noir#9737) chore(ssa): Validate array operands (noir-lang/noir#9932) chore(licm): Add `CanBeHoistedResult::WithRefCount` (noir-lang/noir#9849) chore(ci): alert in slack if fuzzer fails (noir-lang/noir#9910) fix(fmt): missing skip whitespace when formatting match (noir-lang/noir#9905) chore(acir_gen): New shared_context module and some additional unit tests (noir-lang/noir#9895) chore: bump external pinned commits (noir-lang/noir#9902) chore: validate SSA intrinsics arguments and return types (noir-lang/noir#9892) chore(die): small nit to remove a check which is not useful (noir-lang/noir#9898) chore: implement Display for brillig (noir-lang/noir#9893) chore(acir_gen): Call module (noir-lang/noir#9896) feat: allow initializing dynamic arrays (noir-lang/noir#9899) fix(acir_gen): Handle flattening of numeric types when an `Array` contains a `DynamicArray` (noir-lang/noir#9887) fix(mem2reg): Do not attempt to analyze an instruction simplified to a global (noir-lang/noir#9882) fix: error on returning slice from main (noir-lang/noir#9636) fix(acir_gen): Fix entry point indices (noir-lang/noir#9881) chore: move `ram_blowup_regression` to be a compile-only test (noir-lang/noir#9874) chore: validate SSA call arguments (noir-lang/noir#9876) fix(ssa): Simplify always-fail range constraint (noir-lang/noir#9885) chore(fuzz): Refactor logging in the AST fuzzer (noir-lang/noir#9884) chore(ssa_fuzzer): refactor brillig target (noir-lang/noir#9821) fix(fuzz): Always introduce a local binding before match (noir-lang/noir#9883) chore(acir_gen): Switching existing ACIR gen tests to use parser and cleanup test module (noir-lang/noir#9878) chore(acir_gen): Remove Brillig execution with constant arguments (noir-lang/noir#9879) fix: disallow `_` in where clauses, and disallow unused trait impl generics (noir-lang/noir#9871) chore: bump external pinned commits (noir-lang/noir#9875) feat: LSP lightweight mode (noir-lang/noir#9869) chore: use `w` prefix for ACIR witnesses (noir-lang/noir#9839) chore: greenlight remove enable side effects (noir-lang/noir#9833) fix(fuzz): Avoid OOB when `in_no_dynamic` mode (noir-lang/noir#9858) chore(ssa): Run purity analysis before preprocessing of functions (noir-lang/noir#9837) fix: check for signed division overflow (noir-lang/noir#9857) chore: Add tests from post-order PR (noir-lang/noir#9846) chore(acir): Parse full program (foldable functions) (noir-lang/noir#9859) chore: greenlight remove_bit_shifts (revised) (noir-lang/noir#9813) feat(die): Prune unused entry block parameters for non-entry points (noir-lang/noir#9843) chore: greenlight check_u128_mul_overflow (noir-lang/noir#9759) chore: greenlight `remove_unreachable_instructions` for new requirements (noir-lang/noir#9810) chore: use enum for instruction deduplication safety (noir-lang/noir#9824) feat(LSP): signature help for macro attributes (noir-lang/noir#9536) feat(LSP): folding ranges (noir-lang/noir#9854) chore(die): IncrementRc/DecrementRc comments (noir-lang/noir#9855) chore(ownership): Add tests for cloning nested arrays returned from indexing (noir-lang/noir#9789) chore: validate that all jmpif conditions are boolean (noir-lang/noir#9850) chore: bump external pinned commits (noir-lang/noir#9848) chore(opt): Fetch set of Brillig entry points without reachability and recursive functions computation (noir-lang/noir#9844) chore: tests for map in stdlib (noir-lang/noir#9676) chore(ssa): Brillig entry point specialization post check (noir-lang/noir#9845) chore: delete some unused snapshots (noir-lang/noir#9841) feat(ssa): SSA CLI (noir-lang/noir#9826) chore: more ACIR parser usages in tests, and optimize general optimizations (noir-lang/noir#9836) chore(die): Remove RC tracker (noir-lang/noir#9809) feat: better check_u128_mul_overflow logic when an operand is constant (noir-lang/noir#9835) chore: increase number of cases tried in PR fuzzing (noir-lang/noir#9829) chore: remove variable flag from poseidon2 hash (noir-lang/noir#9834) chore: enforce that we only visit blocks once with new deque type (noir-lang/noir#9825) chore(test): add tests for unconstrained `main` recursion (noir-lang/noir#8551) chore: adding tests to vec (noir-lang/noir#9715) feat(fuzz): Allow index OOB with a small probability (noir-lang/noir#9803) chore(die): Encapsulate array access checks in separate module (noir-lang/noir#9828) chore: use the ACIR parser in redundant_ranges tests (noir-lang/noir#9827) chore: prefer `From` for infallible numeric casts (noir-lang/noir#9802) chore: add a regression test for #4663 (noir-lang/noir#9819) chore: bump linked bb version (noir-lang/noir#9237) chore: use `DataFlowGraph` over `Function` in constant_folding (noir-lang/noir#9811) chore: add a regression test for #6285 (noir-lang/noir#9817) feat(fuzz): Generate calls to `slice_remove` and `slice_insert` in the AST fuzzer (noir-lang/noir#9786) chore: no need to use `get_max_num_bits` if lhs is a constant (noir-lang/noir#9812) chore(ci): fix release workflow permissions (noir-lang/noir#9822) fix: do not simplify constraints with induction variable (noir-lang/noir#9806) fix(ssa): Do not hoist unsafe `array_get` in Brillig (noir-lang/noir#9805) fix(ownership): consider ident in nested l-value as used (noir-lang/noir#9793) fix(mem2reg): handle instruction simplified to multiple (noir-lang/noir#9782) fix: proper error when dividing by minus 1 (noir-lang/noir#9762) chore: tests for field in stdlib (noir-lang/noir#9677) chore(ssa_fuzzer): separate fuzzer runtimes + add brillig fuzz target (noir-lang/noir#9753) feat(ownership): Do not clone indexed call results containing arrays (noir-lang/noir#9791) Revert "chore: move `ram_blowup_regression` to be a compile-only test" (noir-lang/noir#9801) feat: reverse loop condition in brillig to avoid NOT instruction (noir-lang/noir#9779) chore: move `ram_blowup_regression` to be a compile-only test (noir-lang/noir#9790) fix(docs): moves docs to correct path for sharing domain with landing (noir-lang/noir#9687) chore: Check an inline always weight threshold during inline info computation (noir-lang/noir#9487) chore: remove snapshots from `test_programs` artifacts (noir-lang/noir#9788) chore: bump `@web/dev-server-esbuild` and `playwright` (noir-lang/noir#9781) fix(ssa): Replace failing array access with constraint and defaults (noir-lang/noir#9776) chore(die): Module doc comments (noir-lang/noir#9768) chore: encapsulate constant folding logic better (noir-lang/noir#9773) chore(ci): publish attestations on uploaded binaries (noir-lang/noir#9777) feat: remove useless jump when branching in brillig (noir-lang/noir#9778) chore: add `LoopContext::new` (noir-lang/noir#9720) feat(ownership): Do not clone nested Index expressions (noir-lang/noir#9772) chore(ci): add permissions to CI workflows (noir-lang/noir#9763) fix(ssa): Accurate purities of ArraySet and RC instructions in Brillig (noir-lang/noir#9736) chore: add test for when pending snapshots are committed (noir-lang/noir#9757) chore(docs): Copy latest getting started guide into versioned docs (noir-lang/noir#9755) chore: migrate away from fxhash to address advisory (noir-lang/noir#9752) fix(fuzz): Install `just` in nightly fuzz workflow (noir-lang/noir#9756) fix: wrong error message in brillig bit shift overflow (noir-lang/noir#9702) chore: bump dependencies (noir-lang/noir#9751) fix: left bit shift u128 would overflow Field (noir-lang/noir#9723) Revert "chore: migrate away from fxhash to address advisory (noir-lang/noir#9750)" chore: migrate away from fxhash to address advisory (noir-lang/noir#9750) chore: bump external pinned commits (noir-lang/noir#9748) chore(inlining): Skip weight calc for ACIR functions and recursive Brillig functions (noir-lang/noir#9739) chore(ssa): Consolidate should inline check into a single filter (noir-lang/noir#9738) feat: re-enable early mem2reg pass (noir-lang/noir#9744) fix(ssa): Mark whether an ArrayGet requires a predicate based upon the runtime (noir-lang/noir#9712) chore(licm): Identify untested code; refactoring; minor fixes (noir-lang/noir#9718) chore(docs): Update Aztec logo in noir docs (noir-lang/noir#9740) chore(ssa_fuzzer): refactor ssa fuzzer (noir-lang/noir#9651) fix: error on boolean shift overflow in interpreter (noir-lang/noir#9724) chore: do not inline acir calls in brillig (noir-lang/noir#9412) chore: remove empty main from frontend tests (noir-lang/noir#9726) chore: add tests for slice (noir-lang/noir#9650) chore: greenlight `make_constrain_not_equal` for audits (noir-lang/noir#9535) chore: Release Noir(1.0.0-beta.12) (noir-lang/noir#9565) chore(test): Filter `ram_blowup_regression` by default on local testing (noir-lang/noir#9721) chore(ci): force cargo-binstall to install tools in CI (noir-lang/noir#9722) fix(ssa): Simplify instructions during `remove_unreachable_instructions` (noir-lang/noir#9709) END_COMMIT_OVERRIDE Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: print ACIR AssertZero as an equation (noir-lang/noir#9970) chore(acir): Switch to inline SSA for slice intrinsics tests (noir-lang/noir#10000) fix(fuzz): Handle divisor of zero msg in error comparison (noir-lang/noir#9995) fix(ssa): Handle OOB indexing of slice literals in `remove_unreachalbe_instructions` (noir-lang/noir#9999) chore: Add `DataFlowGraph::instruction_result` for getting a known number of results (noir-lang/noir#9989) chore(ast_fuzzer): Allow passing compilation options to cvise tool (noir-lang/noir#9996) chore(ssa_gen): Do not generate out of bounds checks for array assignments in ACIR (noir-lang/noir#9992) chore: add more to/from le/be bits/bytes edge case tests (noir-lang/noir#9906) fix: Disable early mem2reg (noir-lang/noir#9987) chore(ci): free up space on github runner (noir-lang/noir#9994) chore(ssa): Nits in `remove_bit_shift` and `remove_if_else` (noir-lang/noir#9965) chore(ssa_executor): add compilation example (noir-lang/noir#9937) chore(acir): More arrays refactors (noir-lang/noir#9962) chore(test): add panicking tests for 'defunctionalize' (noir-lang/noir#8510) chore: remove_if_else docs and refactors (noir-lang/noir#9929) chore(acir): Do not copy element type sizes array when initializing (noir-lang/noir#9955) fix: correct max_bit_size when left-shifting (noir-lang/noir#9770) chore: checked_to_unchecked enhancements from audit review (noir-lang/noir#9958) chore(ssa): Remove `offset` from `ArrayGet` and `ArraySet` (noir-lang/noir#9956) chore(acir): Add some unit tests for arrays and light refactors (noir-lang/noir#9953) chore: add regression test for #9852 (noir-lang/noir#9960) chore(fuzz): Add error equivalency for bit-shift overflow in the SSA interpreter (noir-lang/noir#9957) feat(cli): Visualize the Control Flow Graph (noir-lang/noir#9867) chore: minor constant_folding refactors (noir-lang/noir#9954) chore!: several ACIR serialisation changes (noir-lang/noir#8134) chore(ci): only send slack notifications during the week (noir-lang/noir#9946) chore: assumes no load-store in array_set (noir-lang/noir#9940) chore(acir): Arrays module doc comments (noir-lang/noir#9947) fix: correctly handle unusual radices in `ToRadix` decompositions (noir-lang/noir#9941) fix(ssa): Start with checked operations in index calculations (noir-lang/noir#9888) feat: no need to use dummy slice values in remove_if_else (noir-lang/noir#9928) chore: bump external pinned commits (noir-lang/noir#9938) chore: redo typo PR by viktorking7 (noir-lang/noir#9939) chore: Release Noir(1.0.0-beta.13) (noir-lang/noir#9737) chore(ssa): Validate array operands (noir-lang/noir#9932) chore(licm): Add `CanBeHoistedResult::WithRefCount` (noir-lang/noir#9849) chore(ci): alert in slack if fuzzer fails (noir-lang/noir#9910) fix(fmt): missing skip whitespace when formatting match (noir-lang/noir#9905) chore(acir_gen): New shared_context module and some additional unit tests (noir-lang/noir#9895) chore: bump external pinned commits (noir-lang/noir#9902) chore: validate SSA intrinsics arguments and return types (noir-lang/noir#9892) chore(die): small nit to remove a check which is not useful (noir-lang/noir#9898) chore: implement Display for brillig (noir-lang/noir#9893) chore(acir_gen): Call module (noir-lang/noir#9896) feat: allow initializing dynamic arrays (noir-lang/noir#9899) fix(acir_gen): Handle flattening of numeric types when an `Array` contains a `DynamicArray` (noir-lang/noir#9887) fix(mem2reg): Do not attempt to analyze an instruction simplified to a global (noir-lang/noir#9882) fix: error on returning slice from main (noir-lang/noir#9636) fix(acir_gen): Fix entry point indices (noir-lang/noir#9881) chore: move `ram_blowup_regression` to be a compile-only test (noir-lang/noir#9874) chore: validate SSA call arguments (noir-lang/noir#9876) fix(ssa): Simplify always-fail range constraint (noir-lang/noir#9885) chore(fuzz): Refactor logging in the AST fuzzer (noir-lang/noir#9884) chore(ssa_fuzzer): refactor brillig target (noir-lang/noir#9821) fix(fuzz): Always introduce a local binding before match (noir-lang/noir#9883) chore(acir_gen): Switching existing ACIR gen tests to use parser and cleanup test module (noir-lang/noir#9878) chore(acir_gen): Remove Brillig execution with constant arguments (noir-lang/noir#9879) fix: disallow `_` in where clauses, and disallow unused trait impl generics (noir-lang/noir#9871) chore: bump external pinned commits (noir-lang/noir#9875) feat: LSP lightweight mode (noir-lang/noir#9869) chore: use `w` prefix for ACIR witnesses (noir-lang/noir#9839) chore: greenlight remove enable side effects (noir-lang/noir#9833) fix(fuzz): Avoid OOB when `in_no_dynamic` mode (noir-lang/noir#9858) chore(ssa): Run purity analysis before preprocessing of functions (noir-lang/noir#9837) fix: check for signed division overflow (noir-lang/noir#9857) chore: Add tests from post-order PR (noir-lang/noir#9846) chore(acir): Parse full program (foldable functions) (noir-lang/noir#9859) chore: greenlight remove_bit_shifts (revised) (noir-lang/noir#9813) feat(die): Prune unused entry block parameters for non-entry points (noir-lang/noir#9843) chore: greenlight check_u128_mul_overflow (noir-lang/noir#9759) chore: greenlight `remove_unreachable_instructions` for new requirements (noir-lang/noir#9810) chore: use enum for instruction deduplication safety (noir-lang/noir#9824) feat(LSP): signature help for macro attributes (noir-lang/noir#9536) feat(LSP): folding ranges (noir-lang/noir#9854) chore(die): IncrementRc/DecrementRc comments (noir-lang/noir#9855) chore(ownership): Add tests for cloning nested arrays returned from indexing (noir-lang/noir#9789) chore: validate that all jmpif conditions are boolean (noir-lang/noir#9850) chore: bump external pinned commits (noir-lang/noir#9848) chore(opt): Fetch set of Brillig entry points without reachability and recursive functions computation (noir-lang/noir#9844) chore: tests for map in stdlib (noir-lang/noir#9676) chore(ssa): Brillig entry point specialization post check (noir-lang/noir#9845) chore: delete some unused snapshots (noir-lang/noir#9841) feat(ssa): SSA CLI (noir-lang/noir#9826) chore: more ACIR parser usages in tests, and optimize general optimizations (noir-lang/noir#9836) chore(die): Remove RC tracker (noir-lang/noir#9809) feat: better check_u128_mul_overflow logic when an operand is constant (noir-lang/noir#9835) chore: increase number of cases tried in PR fuzzing (noir-lang/noir#9829) chore: remove variable flag from poseidon2 hash (noir-lang/noir#9834) chore: enforce that we only visit blocks once with new deque type (noir-lang/noir#9825) chore(test): add tests for unconstrained `main` recursion (noir-lang/noir#8551) chore: adding tests to vec (noir-lang/noir#9715) feat(fuzz): Allow index OOB with a small probability (noir-lang/noir#9803) chore(die): Encapsulate array access checks in separate module (noir-lang/noir#9828) chore: use the ACIR parser in redundant_ranges tests (noir-lang/noir#9827) chore: prefer `From` for infallible numeric casts (noir-lang/noir#9802) chore: add a regression test for #4663 (noir-lang/noir#9819) chore: bump linked bb version (noir-lang/noir#9237) chore: use `DataFlowGraph` over `Function` in constant_folding (noir-lang/noir#9811) chore: add a regression test for #6285 (noir-lang/noir#9817) feat(fuzz): Generate calls to `slice_remove` and `slice_insert` in the AST fuzzer (noir-lang/noir#9786) chore: no need to use `get_max_num_bits` if lhs is a constant (noir-lang/noir#9812) chore(ci): fix release workflow permissions (noir-lang/noir#9822) fix: do not simplify constraints with induction variable (noir-lang/noir#9806) fix(ssa): Do not hoist unsafe `array_get` in Brillig (noir-lang/noir#9805) fix(ownership): consider ident in nested l-value as used (noir-lang/noir#9793) fix(mem2reg): handle instruction simplified to multiple (noir-lang/noir#9782) fix: proper error when dividing by minus 1 (noir-lang/noir#9762) chore: tests for field in stdlib (noir-lang/noir#9677) chore(ssa_fuzzer): separate fuzzer runtimes + add brillig fuzz target (noir-lang/noir#9753) feat(ownership): Do not clone indexed call results containing arrays (noir-lang/noir#9791) Revert "chore: move `ram_blowup_regression` to be a compile-only test" (noir-lang/noir#9801) feat: reverse loop condition in brillig to avoid NOT instruction (noir-lang/noir#9779) chore: move `ram_blowup_regression` to be a compile-only test (noir-lang/noir#9790) fix(docs): moves docs to correct path for sharing domain with landing (noir-lang/noir#9687) chore: Check an inline always weight threshold during inline info computation (noir-lang/noir#9487) chore: remove snapshots from `test_programs` artifacts (noir-lang/noir#9788) chore: bump `@web/dev-server-esbuild` and `playwright` (noir-lang/noir#9781) fix(ssa): Replace failing array access with constraint and defaults (noir-lang/noir#9776) chore(die): Module doc comments (noir-lang/noir#9768) chore: encapsulate constant folding logic better (noir-lang/noir#9773) chore(ci): publish attestations on uploaded binaries (noir-lang/noir#9777) feat: remove useless jump when branching in brillig (noir-lang/noir#9778) chore: add `LoopContext::new` (noir-lang/noir#9720) feat(ownership): Do not clone nested Index expressions (noir-lang/noir#9772) chore(ci): add permissions to CI workflows (noir-lang/noir#9763) fix(ssa): Accurate purities of ArraySet and RC instructions in Brillig (noir-lang/noir#9736) chore: add test for when pending snapshots are committed (noir-lang/noir#9757) chore(docs): Copy latest getting started guide into versioned docs (noir-lang/noir#9755) chore: migrate away from fxhash to address advisory (noir-lang/noir#9752) fix(fuzz): Install `just` in nightly fuzz workflow (noir-lang/noir#9756) fix: wrong error message in brillig bit shift overflow (noir-lang/noir#9702) chore: bump dependencies (noir-lang/noir#9751) fix: left bit shift u128 would overflow Field (noir-lang/noir#9723) Revert "chore: migrate away from fxhash to address advisory (noir-lang/noir#9750)" chore: migrate away from fxhash to address advisory (noir-lang/noir#9750) chore: bump external pinned commits (noir-lang/noir#9748) chore(inlining): Skip weight calc for ACIR functions and recursive Brillig functions (noir-lang/noir#9739) chore(ssa): Consolidate should inline check into a single filter (noir-lang/noir#9738) feat: re-enable early mem2reg pass (noir-lang/noir#9744) fix(ssa): Mark whether an ArrayGet requires a predicate based upon the runtime (noir-lang/noir#9712) chore(licm): Identify untested code; refactoring; minor fixes (noir-lang/noir#9718) chore(docs): Update Aztec logo in noir docs (noir-lang/noir#9740) chore(ssa_fuzzer): refactor ssa fuzzer (noir-lang/noir#9651) fix: error on boolean shift overflow in interpreter (noir-lang/noir#9724) chore: do not inline acir calls in brillig (noir-lang/noir#9412) chore: remove empty main from frontend tests (noir-lang/noir#9726) chore: add tests for slice (noir-lang/noir#9650) chore: greenlight `make_constrain_not_equal` for audits (noir-lang/noir#9535) chore: Release Noir(1.0.0-beta.12) (noir-lang/noir#9565) chore(test): Filter `ram_blowup_regression` by default on local testing (noir-lang/noir#9721) chore(ci): force cargo-binstall to install tools in CI (noir-lang/noir#9722) fix(ssa): Simplify instructions during `remove_unreachable_instructions` (noir-lang/noir#9709) END_COMMIT_OVERRIDE
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: print ACIR AssertZero as an equation (noir-lang/noir#9970) chore(acir): Switch to inline SSA for slice intrinsics tests (noir-lang/noir#10000) fix(fuzz): Handle divisor of zero msg in error comparison (noir-lang/noir#9995) fix(ssa): Handle OOB indexing of slice literals in `remove_unreachalbe_instructions` (noir-lang/noir#9999) chore: Add `DataFlowGraph::instruction_result` for getting a known number of results (noir-lang/noir#9989) chore(ast_fuzzer): Allow passing compilation options to cvise tool (noir-lang/noir#9996) chore(ssa_gen): Do not generate out of bounds checks for array assignments in ACIR (noir-lang/noir#9992) chore: add more to/from le/be bits/bytes edge case tests (noir-lang/noir#9906) fix: Disable early mem2reg (noir-lang/noir#9987) chore(ci): free up space on github runner (noir-lang/noir#9994) chore(ssa): Nits in `remove_bit_shift` and `remove_if_else` (noir-lang/noir#9965) chore(ssa_executor): add compilation example (noir-lang/noir#9937) chore(acir): More arrays refactors (noir-lang/noir#9962) chore(test): add panicking tests for 'defunctionalize' (noir-lang/noir#8510) chore: remove_if_else docs and refactors (noir-lang/noir#9929) chore(acir): Do not copy element type sizes array when initializing (noir-lang/noir#9955) fix: correct max_bit_size when left-shifting (noir-lang/noir#9770) chore: checked_to_unchecked enhancements from audit review (noir-lang/noir#9958) chore(ssa): Remove `offset` from `ArrayGet` and `ArraySet` (noir-lang/noir#9956) chore(acir): Add some unit tests for arrays and light refactors (noir-lang/noir#9953) chore: add regression test for #9852 (noir-lang/noir#9960) chore(fuzz): Add error equivalency for bit-shift overflow in the SSA interpreter (noir-lang/noir#9957) feat(cli): Visualize the Control Flow Graph (noir-lang/noir#9867) chore: minor constant_folding refactors (noir-lang/noir#9954) chore!: several ACIR serialisation changes (noir-lang/noir#8134) chore(ci): only send slack notifications during the week (noir-lang/noir#9946) chore: assumes no load-store in array_set (noir-lang/noir#9940) chore(acir): Arrays module doc comments (noir-lang/noir#9947) fix: correctly handle unusual radices in `ToRadix` decompositions (noir-lang/noir#9941) fix(ssa): Start with checked operations in index calculations (noir-lang/noir#9888) feat: no need to use dummy slice values in remove_if_else (noir-lang/noir#9928) chore: bump external pinned commits (noir-lang/noir#9938) chore: redo typo PR by viktorking7 (noir-lang/noir#9939) chore: Release Noir(1.0.0-beta.13) (noir-lang/noir#9737) chore(ssa): Validate array operands (noir-lang/noir#9932) chore(licm): Add `CanBeHoistedResult::WithRefCount` (noir-lang/noir#9849) chore(ci): alert in slack if fuzzer fails (noir-lang/noir#9910) fix(fmt): missing skip whitespace when formatting match (noir-lang/noir#9905) chore(acir_gen): New shared_context module and some additional unit tests (noir-lang/noir#9895) chore: bump external pinned commits (noir-lang/noir#9902) chore: validate SSA intrinsics arguments and return types (noir-lang/noir#9892) chore(die): small nit to remove a check which is not useful (noir-lang/noir#9898) chore: implement Display for brillig (noir-lang/noir#9893) chore(acir_gen): Call module (noir-lang/noir#9896) feat: allow initializing dynamic arrays (noir-lang/noir#9899) fix(acir_gen): Handle flattening of numeric types when an `Array` contains a `DynamicArray` (noir-lang/noir#9887) fix(mem2reg): Do not attempt to analyze an instruction simplified to a global (noir-lang/noir#9882) fix: error on returning slice from main (noir-lang/noir#9636) fix(acir_gen): Fix entry point indices (noir-lang/noir#9881) chore: move `ram_blowup_regression` to be a compile-only test (noir-lang/noir#9874) chore: validate SSA call arguments (noir-lang/noir#9876) fix(ssa): Simplify always-fail range constraint (noir-lang/noir#9885) chore(fuzz): Refactor logging in the AST fuzzer (noir-lang/noir#9884) chore(ssa_fuzzer): refactor brillig target (noir-lang/noir#9821) fix(fuzz): Always introduce a local binding before match (noir-lang/noir#9883) chore(acir_gen): Switching existing ACIR gen tests to use parser and cleanup test module (noir-lang/noir#9878) chore(acir_gen): Remove Brillig execution with constant arguments (noir-lang/noir#9879) fix: disallow `_` in where clauses, and disallow unused trait impl generics (noir-lang/noir#9871) chore: bump external pinned commits (noir-lang/noir#9875) feat: LSP lightweight mode (noir-lang/noir#9869) chore: use `w` prefix for ACIR witnesses (noir-lang/noir#9839) chore: greenlight remove enable side effects (noir-lang/noir#9833) fix(fuzz): Avoid OOB when `in_no_dynamic` mode (noir-lang/noir#9858) chore(ssa): Run purity analysis before preprocessing of functions (noir-lang/noir#9837) fix: check for signed division overflow (noir-lang/noir#9857) chore: Add tests from post-order PR (noir-lang/noir#9846) chore(acir): Parse full program (foldable functions) (noir-lang/noir#9859) chore: greenlight remove_bit_shifts (revised) (noir-lang/noir#9813) feat(die): Prune unused entry block parameters for non-entry points (noir-lang/noir#9843) chore: greenlight check_u128_mul_overflow (noir-lang/noir#9759) chore: greenlight `remove_unreachable_instructions` for new requirements (noir-lang/noir#9810) chore: use enum for instruction deduplication safety (noir-lang/noir#9824) feat(LSP): signature help for macro attributes (noir-lang/noir#9536) feat(LSP): folding ranges (noir-lang/noir#9854) chore(die): IncrementRc/DecrementRc comments (noir-lang/noir#9855) chore(ownership): Add tests for cloning nested arrays returned from indexing (noir-lang/noir#9789) chore: validate that all jmpif conditions are boolean (noir-lang/noir#9850) chore: bump external pinned commits (noir-lang/noir#9848) chore(opt): Fetch set of Brillig entry points without reachability and recursive functions computation (noir-lang/noir#9844) chore: tests for map in stdlib (noir-lang/noir#9676) chore(ssa): Brillig entry point specialization post check (noir-lang/noir#9845) chore: delete some unused snapshots (noir-lang/noir#9841) feat(ssa): SSA CLI (noir-lang/noir#9826) chore: more ACIR parser usages in tests, and optimize general optimizations (noir-lang/noir#9836) chore(die): Remove RC tracker (noir-lang/noir#9809) feat: better check_u128_mul_overflow logic when an operand is constant (noir-lang/noir#9835) chore: increase number of cases tried in PR fuzzing (noir-lang/noir#9829) chore: remove variable flag from poseidon2 hash (noir-lang/noir#9834) chore: enforce that we only visit blocks once with new deque type (noir-lang/noir#9825) chore(test): add tests for unconstrained `main` recursion (noir-lang/noir#8551) chore: adding tests to vec (noir-lang/noir#9715) feat(fuzz): Allow index OOB with a small probability (noir-lang/noir#9803) chore(die): Encapsulate array access checks in separate module (noir-lang/noir#9828) chore: use the ACIR parser in redundant_ranges tests (noir-lang/noir#9827) chore: prefer `From` for infallible numeric casts (noir-lang/noir#9802) chore: add a regression test for #4663 (noir-lang/noir#9819) chore: bump linked bb version (noir-lang/noir#9237) chore: use `DataFlowGraph` over `Function` in constant_folding (noir-lang/noir#9811) chore: add a regression test for #6285 (noir-lang/noir#9817) feat(fuzz): Generate calls to `slice_remove` and `slice_insert` in the AST fuzzer (noir-lang/noir#9786) chore: no need to use `get_max_num_bits` if lhs is a constant (noir-lang/noir#9812) chore(ci): fix release workflow permissions (noir-lang/noir#9822) fix: do not simplify constraints with induction variable (noir-lang/noir#9806) fix(ssa): Do not hoist unsafe `array_get` in Brillig (noir-lang/noir#9805) fix(ownership): consider ident in nested l-value as used (noir-lang/noir#9793) fix(mem2reg): handle instruction simplified to multiple (noir-lang/noir#9782) fix: proper error when dividing by minus 1 (noir-lang/noir#9762) chore: tests for field in stdlib (noir-lang/noir#9677) chore(ssa_fuzzer): separate fuzzer runtimes + add brillig fuzz target (noir-lang/noir#9753) feat(ownership): Do not clone indexed call results containing arrays (noir-lang/noir#9791) Revert "chore: move `ram_blowup_regression` to be a compile-only test" (noir-lang/noir#9801) feat: reverse loop condition in brillig to avoid NOT instruction (noir-lang/noir#9779) chore: move `ram_blowup_regression` to be a compile-only test (noir-lang/noir#9790) fix(docs): moves docs to correct path for sharing domain with landing (noir-lang/noir#9687) chore: Check an inline always weight threshold during inline info computation (noir-lang/noir#9487) chore: remove snapshots from `test_programs` artifacts (noir-lang/noir#9788) chore: bump `@web/dev-server-esbuild` and `playwright` (noir-lang/noir#9781) fix(ssa): Replace failing array access with constraint and defaults (noir-lang/noir#9776) chore(die): Module doc comments (noir-lang/noir#9768) chore: encapsulate constant folding logic better (noir-lang/noir#9773) chore(ci): publish attestations on uploaded binaries (noir-lang/noir#9777) feat: remove useless jump when branching in brillig (noir-lang/noir#9778) chore: add `LoopContext::new` (noir-lang/noir#9720) feat(ownership): Do not clone nested Index expressions (noir-lang/noir#9772) chore(ci): add permissions to CI workflows (noir-lang/noir#9763) fix(ssa): Accurate purities of ArraySet and RC instructions in Brillig (noir-lang/noir#9736) chore: add test for when pending snapshots are committed (noir-lang/noir#9757) chore(docs): Copy latest getting started guide into versioned docs (noir-lang/noir#9755) chore: migrate away from fxhash to address advisory (noir-lang/noir#9752) fix(fuzz): Install `just` in nightly fuzz workflow (noir-lang/noir#9756) fix: wrong error message in brillig bit shift overflow (noir-lang/noir#9702) chore: bump dependencies (noir-lang/noir#9751) fix: left bit shift u128 would overflow Field (noir-lang/noir#9723) Revert "chore: migrate away from fxhash to address advisory (noir-lang/noir#9750)" chore: migrate away from fxhash to address advisory (noir-lang/noir#9750) chore: bump external pinned commits (noir-lang/noir#9748) chore(inlining): Skip weight calc for ACIR functions and recursive Brillig functions (noir-lang/noir#9739) chore(ssa): Consolidate should inline check into a single filter (noir-lang/noir#9738) feat: re-enable early mem2reg pass (noir-lang/noir#9744) fix(ssa): Mark whether an ArrayGet requires a predicate based upon the runtime (noir-lang/noir#9712) chore(licm): Identify untested code; refactoring; minor fixes (noir-lang/noir#9718) chore(docs): Update Aztec logo in noir docs (noir-lang/noir#9740) chore(ssa_fuzzer): refactor ssa fuzzer (noir-lang/noir#9651) fix: error on boolean shift overflow in interpreter (noir-lang/noir#9724) chore: do not inline acir calls in brillig (noir-lang/noir#9412) chore: remove empty main from frontend tests (noir-lang/noir#9726) chore: add tests for slice (noir-lang/noir#9650) chore: greenlight `make_constrain_not_equal` for audits (noir-lang/noir#9535) chore: Release Noir(1.0.0-beta.12) (noir-lang/noir#9565) chore(test): Filter `ram_blowup_regression` by default on local testing (noir-lang/noir#9721) chore(ci): force cargo-binstall to install tools in CI (noir-lang/noir#9722) fix(ssa): Simplify instructions during `remove_unreachable_instructions` (noir-lang/noir#9709) END_COMMIT_OVERRIDE
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE chore: print ACIR AssertZero as an equation (noir-lang/noir#9970) chore(acir): Switch to inline SSA for slice intrinsics tests (noir-lang/noir#10000) fix(fuzz): Handle divisor of zero msg in error comparison (noir-lang/noir#9995) fix(ssa): Handle OOB indexing of slice literals in `remove_unreachalbe_instructions` (noir-lang/noir#9999) chore: Add `DataFlowGraph::instruction_result` for getting a known number of results (noir-lang/noir#9989) chore(ast_fuzzer): Allow passing compilation options to cvise tool (noir-lang/noir#9996) chore(ssa_gen): Do not generate out of bounds checks for array assignments in ACIR (noir-lang/noir#9992) chore: add more to/from le/be bits/bytes edge case tests (noir-lang/noir#9906) fix: Disable early mem2reg (noir-lang/noir#9987) chore(ci): free up space on github runner (noir-lang/noir#9994) chore(ssa): Nits in `remove_bit_shift` and `remove_if_else` (noir-lang/noir#9965) chore(ssa_executor): add compilation example (noir-lang/noir#9937) chore(acir): More arrays refactors (noir-lang/noir#9962) chore(test): add panicking tests for 'defunctionalize' (noir-lang/noir#8510) chore: remove_if_else docs and refactors (noir-lang/noir#9929) chore(acir): Do not copy element type sizes array when initializing (noir-lang/noir#9955) fix: correct max_bit_size when left-shifting (noir-lang/noir#9770) chore: checked_to_unchecked enhancements from audit review (noir-lang/noir#9958) chore(ssa): Remove `offset` from `ArrayGet` and `ArraySet` (noir-lang/noir#9956) chore(acir): Add some unit tests for arrays and light refactors (noir-lang/noir#9953) chore: add regression test for #9852 (noir-lang/noir#9960) chore(fuzz): Add error equivalency for bit-shift overflow in the SSA interpreter (noir-lang/noir#9957) feat(cli): Visualize the Control Flow Graph (noir-lang/noir#9867) chore: minor constant_folding refactors (noir-lang/noir#9954) chore!: several ACIR serialisation changes (noir-lang/noir#8134) chore(ci): only send slack notifications during the week (noir-lang/noir#9946) chore: assumes no load-store in array_set (noir-lang/noir#9940) chore(acir): Arrays module doc comments (noir-lang/noir#9947) fix: correctly handle unusual radices in `ToRadix` decompositions (noir-lang/noir#9941) fix(ssa): Start with checked operations in index calculations (noir-lang/noir#9888) feat: no need to use dummy slice values in remove_if_else (noir-lang/noir#9928) chore: bump external pinned commits (noir-lang/noir#9938) chore: redo typo PR by viktorking7 (noir-lang/noir#9939) chore: Release Noir(1.0.0-beta.13) (noir-lang/noir#9737) chore(ssa): Validate array operands (noir-lang/noir#9932) chore(licm): Add `CanBeHoistedResult::WithRefCount` (noir-lang/noir#9849) chore(ci): alert in slack if fuzzer fails (noir-lang/noir#9910) fix(fmt): missing skip whitespace when formatting match (noir-lang/noir#9905) chore(acir_gen): New shared_context module and some additional unit tests (noir-lang/noir#9895) chore: bump external pinned commits (noir-lang/noir#9902) chore: validate SSA intrinsics arguments and return types (noir-lang/noir#9892) chore(die): small nit to remove a check which is not useful (noir-lang/noir#9898) chore: implement Display for brillig (noir-lang/noir#9893) chore(acir_gen): Call module (noir-lang/noir#9896) feat: allow initializing dynamic arrays (noir-lang/noir#9899) fix(acir_gen): Handle flattening of numeric types when an `Array` contains a `DynamicArray` (noir-lang/noir#9887) fix(mem2reg): Do not attempt to analyze an instruction simplified to a global (noir-lang/noir#9882) fix: error on returning slice from main (noir-lang/noir#9636) fix(acir_gen): Fix entry point indices (noir-lang/noir#9881) chore: move `ram_blowup_regression` to be a compile-only test (noir-lang/noir#9874) chore: validate SSA call arguments (noir-lang/noir#9876) fix(ssa): Simplify always-fail range constraint (noir-lang/noir#9885) chore(fuzz): Refactor logging in the AST fuzzer (noir-lang/noir#9884) chore(ssa_fuzzer): refactor brillig target (noir-lang/noir#9821) fix(fuzz): Always introduce a local binding before match (noir-lang/noir#9883) chore(acir_gen): Switching existing ACIR gen tests to use parser and cleanup test module (noir-lang/noir#9878) chore(acir_gen): Remove Brillig execution with constant arguments (noir-lang/noir#9879) fix: disallow `_` in where clauses, and disallow unused trait impl generics (noir-lang/noir#9871) chore: bump external pinned commits (noir-lang/noir#9875) feat: LSP lightweight mode (noir-lang/noir#9869) chore: use `w` prefix for ACIR witnesses (noir-lang/noir#9839) chore: greenlight remove enable side effects (noir-lang/noir#9833) fix(fuzz): Avoid OOB when `in_no_dynamic` mode (noir-lang/noir#9858) chore(ssa): Run purity analysis before preprocessing of functions (noir-lang/noir#9837) fix: check for signed division overflow (noir-lang/noir#9857) chore: Add tests from post-order PR (noir-lang/noir#9846) chore(acir): Parse full program (foldable functions) (noir-lang/noir#9859) chore: greenlight remove_bit_shifts (revised) (noir-lang/noir#9813) feat(die): Prune unused entry block parameters for non-entry points (noir-lang/noir#9843) chore: greenlight check_u128_mul_overflow (noir-lang/noir#9759) chore: greenlight `remove_unreachable_instructions` for new requirements (noir-lang/noir#9810) chore: use enum for instruction deduplication safety (noir-lang/noir#9824) feat(LSP): signature help for macro attributes (noir-lang/noir#9536) feat(LSP): folding ranges (noir-lang/noir#9854) chore(die): IncrementRc/DecrementRc comments (noir-lang/noir#9855) chore(ownership): Add tests for cloning nested arrays returned from indexing (noir-lang/noir#9789) chore: validate that all jmpif conditions are boolean (noir-lang/noir#9850) chore: bump external pinned commits (noir-lang/noir#9848) chore(opt): Fetch set of Brillig entry points without reachability and recursive functions computation (noir-lang/noir#9844) chore: tests for map in stdlib (noir-lang/noir#9676) chore(ssa): Brillig entry point specialization post check (noir-lang/noir#9845) chore: delete some unused snapshots (noir-lang/noir#9841) feat(ssa): SSA CLI (noir-lang/noir#9826) chore: more ACIR parser usages in tests, and optimize general optimizations (noir-lang/noir#9836) chore(die): Remove RC tracker (noir-lang/noir#9809) feat: better check_u128_mul_overflow logic when an operand is constant (noir-lang/noir#9835) chore: increase number of cases tried in PR fuzzing (noir-lang/noir#9829) chore: remove variable flag from poseidon2 hash (noir-lang/noir#9834) chore: enforce that we only visit blocks once with new deque type (noir-lang/noir#9825) chore(test): add tests for unconstrained `main` recursion (noir-lang/noir#8551) chore: adding tests to vec (noir-lang/noir#9715) feat(fuzz): Allow index OOB with a small probability (noir-lang/noir#9803) chore(die): Encapsulate array access checks in separate module (noir-lang/noir#9828) chore: use the ACIR parser in redundant_ranges tests (noir-lang/noir#9827) chore: prefer `From` for infallible numeric casts (noir-lang/noir#9802) chore: add a regression test for #4663 (noir-lang/noir#9819) chore: bump linked bb version (noir-lang/noir#9237) chore: use `DataFlowGraph` over `Function` in constant_folding (noir-lang/noir#9811) chore: add a regression test for #6285 (noir-lang/noir#9817) feat(fuzz): Generate calls to `slice_remove` and `slice_insert` in the AST fuzzer (noir-lang/noir#9786) chore: no need to use `get_max_num_bits` if lhs is a constant (noir-lang/noir#9812) chore(ci): fix release workflow permissions (noir-lang/noir#9822) fix: do not simplify constraints with induction variable (noir-lang/noir#9806) fix(ssa): Do not hoist unsafe `array_get` in Brillig (noir-lang/noir#9805) fix(ownership): consider ident in nested l-value as used (noir-lang/noir#9793) fix(mem2reg): handle instruction simplified to multiple (noir-lang/noir#9782) fix: proper error when dividing by minus 1 (noir-lang/noir#9762) chore: tests for field in stdlib (noir-lang/noir#9677) chore(ssa_fuzzer): separate fuzzer runtimes + add brillig fuzz target (noir-lang/noir#9753) feat(ownership): Do not clone indexed call results containing arrays (noir-lang/noir#9791) Revert "chore: move `ram_blowup_regression` to be a compile-only test" (noir-lang/noir#9801) feat: reverse loop condition in brillig to avoid NOT instruction (noir-lang/noir#9779) chore: move `ram_blowup_regression` to be a compile-only test (noir-lang/noir#9790) fix(docs): moves docs to correct path for sharing domain with landing (noir-lang/noir#9687) chore: Check an inline always weight threshold during inline info computation (noir-lang/noir#9487) chore: remove snapshots from `test_programs` artifacts (noir-lang/noir#9788) chore: bump `@web/dev-server-esbuild` and `playwright` (noir-lang/noir#9781) fix(ssa): Replace failing array access with constraint and defaults (noir-lang/noir#9776) chore(die): Module doc comments (noir-lang/noir#9768) chore: encapsulate constant folding logic better (noir-lang/noir#9773) chore(ci): publish attestations on uploaded binaries (noir-lang/noir#9777) feat: remove useless jump when branching in brillig (noir-lang/noir#9778) chore: add `LoopContext::new` (noir-lang/noir#9720) feat(ownership): Do not clone nested Index expressions (noir-lang/noir#9772) chore(ci): add permissions to CI workflows (noir-lang/noir#9763) fix(ssa): Accurate purities of ArraySet and RC instructions in Brillig (noir-lang/noir#9736) chore: add test for when pending snapshots are committed (noir-lang/noir#9757) chore(docs): Copy latest getting started guide into versioned docs (noir-lang/noir#9755) chore: migrate away from fxhash to address advisory (noir-lang/noir#9752) fix(fuzz): Install `just` in nightly fuzz workflow (noir-lang/noir#9756) fix: wrong error message in brillig bit shift overflow (noir-lang/noir#9702) chore: bump dependencies (noir-lang/noir#9751) fix: left bit shift u128 would overflow Field (noir-lang/noir#9723) Revert "chore: migrate away from fxhash to address advisory (noir-lang/noir#9750)" chore: migrate away from fxhash to address advisory (noir-lang/noir#9750) chore: bump external pinned commits (noir-lang/noir#9748) chore(inlining): Skip weight calc for ACIR functions and recursive Brillig functions (noir-lang/noir#9739) chore(ssa): Consolidate should inline check into a single filter (noir-lang/noir#9738) feat: re-enable early mem2reg pass (noir-lang/noir#9744) fix(ssa): Mark whether an ArrayGet requires a predicate based upon the runtime (noir-lang/noir#9712) chore(licm): Identify untested code; refactoring; minor fixes (noir-lang/noir#9718) chore(docs): Update Aztec logo in noir docs (noir-lang/noir#9740) chore(ssa_fuzzer): refactor ssa fuzzer (noir-lang/noir#9651) fix: error on boolean shift overflow in interpreter (noir-lang/noir#9724) chore: do not inline acir calls in brillig (noir-lang/noir#9412) chore: remove empty main from frontend tests (noir-lang/noir#9726) chore: add tests for slice (noir-lang/noir#9650) chore: greenlight `make_constrain_not_equal` for audits (noir-lang/noir#9535) chore: Release Noir(1.0.0-beta.12) (noir-lang/noir#9565) chore(test): Filter `ram_blowup_regression` by default on local testing (noir-lang/noir#9721) chore(ci): force cargo-binstall to install tools in CI (noir-lang/noir#9722) fix(ssa): Simplify instructions during `remove_unreachable_instructions` (noir-lang/noir#9709) END_COMMIT_OVERRIDE
Description
Problem*
Resolves #9856
Summary*
Implements @vezenovm 's idea from #9856 (comment)
When generating SSA for indexing arrays, use
unchecked: falseby default and let thesimplifymachinery promote it tounchecked: trueif we know that it's safe. This prevents such SSA from being generated that 1) SSA interpreter wraps around, 2) ACIR overflows into u64 and beyond and 3) Brillig wraps around but it's protected by constraints.This had some knock-on effects: now that we use
mulinstead ofunchecked_multo calculate an index, it can fail, and when we see that it will,remove_unreachable_indexesreplaces the failing instruction with a default 0. It also does this if e.g. theadd <prev-var>, u32 1follows a failingmul: since theaddrequires a predicate, it is replaced by 0.This has the unfortunate potential for causing type-errors with
array_getwhere the array contains heterogenous data: if e.g. everyindex n * 4 + 3contains au1, but we replace that withindex 0, that could be some different type. The result is somehow the SSA value that is assigned to the result will have the actual type fromindex 0, and then fail when it's used e.g. in a subsequentbinaryoperation, as it doesn't match the other side.I solved this by introducing a
should_replace_instruction_with_defaultsfunction, which verifies that aresult = array_get arr, index 0 -> typechecks out, ie. thattypeof(result) == typeof(array)[0].Another change I made to
replace_unreachable_instructionswas that it is now removing a failing binary instruction, leaving only the constraint. This is so that it's in line with the handling ofarray_getand slice operations. (This wasn't the full motivation, I wanted to remove and replace the binary with a default as well, but it turned out that doing so still did not allow me to detect where the result was used later on, because thesimple_optimizationalready substitutes values, so what I get is just a value ID of the constant zero, not where it came from).Additional Context
I added a test which expects that the SSA interpreter should fail on it, but there is no such integration test group. I'll create a separate issue for that: #9908
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.