Skip to content

Releases: noir-lang/noir

nightly-2024-09-24: feat: swap endianness in-place in keccak implementation (#6128)

24 Sep 02:28
e3cdebe
Compare
Choose a tag to compare
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*

This PR removes the `temp` array created when swapping the endianness of
the `block_bytes` array and just swaps the values in place. This removes
some unnecessary reads/writes from brillig.

## Additional Context



## 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.

nightly-2024-09-23: feat(perf): Allow array set last uses optimization in return block of…

23 Sep 02:28
5598059
Compare
Choose a tag to compare
… Brillig functions (#6119)

# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

Part of general effort to reduce Brillig bytecode sizes.

## Summary\*

We currently only perform the array set last uses optimization on ACIR
functions. This makes sense as the pass only looks only last uses in a
single block. We can start to expand the last uses opt to encompass more
than just ACIR functions and make it aware of the last array set of an
array across blocks. This is quite complex though so this PR currently
just attempts to look at the return block of Brillig functions and see
the effects.

## Additional Context


## 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.

nightly-2024-09-22: feat(perf): Allow array set last uses optimization in return block of…

22 Sep 02:30
5598059
Compare
Choose a tag to compare
… Brillig functions (#6119)

# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

Part of general effort to reduce Brillig bytecode sizes.

## Summary\*

We currently only perform the array set last uses optimization on ACIR
functions. This makes sense as the pass only looks only last uses in a
single block. We can start to expand the last uses opt to encompass more
than just ACIR functions and make it aware of the last array set of an
array across blocks. This is quite complex though so this PR currently
just attempts to look at the return block of Brillig functions and see
the effects.

## Additional Context


## 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.

nightly-2024-09-21: feat(perf): Allow array set last uses optimization in return block of…

21 Sep 02:24
5598059
Compare
Choose a tag to compare
… Brillig functions (#6119)

# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

Part of general effort to reduce Brillig bytecode sizes.

## Summary\*

We currently only perform the array set last uses optimization on ACIR
functions. This makes sense as the pass only looks only last uses in a
single block. We can start to expand the last uses opt to encompass more
than just ACIR functions and make it aware of the last array set of an
array across blocks. This is quite complex though so this PR currently
just attempts to look at the return block of Brillig functions and see
the effects.

## Additional Context


## 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.

nightly-2024-09-20: fix(mem2reg): Remove possibility of underflow (#6107)

20 Sep 02:26
aea5cc7
Compare
Choose a tag to compare
# Description

## Problem\*

Resolves ICE ran into by @asterite 

## Summary\*

After #5925 we have a couple counters that both increment and decrement.
In theory they are never supposed to underflow. @asterite has discovered
a bug with the remaining last stores counter. I would like to implement
the remaining last stores removal in a better way that removes the need
for this counter to be decremented, but for now I just block if by check
we are not decrementing zero.

## Additional Context



## 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.

---------

Co-authored-by: jfecher <[email protected]>

nightly-2024-09-19: chore: fix broken formatting on master (#6096)

19 Sep 02:26
30d7035
Compare
Choose a tag to compare
# Description

## Problem\*

Resolves <!-- Link to GitHub Issue -->

## Summary\*



## Additional Context



## Documentation\*

Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [ ] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.

nightly-2024-09-18: feat(perf): Remove unused loads in mem2reg and last stores per functi…

18 Sep 02:25
19eef30
Compare
Choose a tag to compare
…on (#5925)

# Description

## Problem\*

Partially resolves #4535.

This does not necessarily make SSA "aware of loops" but handles the
situation that we in the issue where we have multiple known stores and
loads that we are unable to resolve across the function due to loops.

## Summary\*

The per function state and the logic run over it has been expanded. We
store more information in `last_loads`, a new `load_results` map to
track unused loads, and a utility map `calls_reference_input` to avoid
deleting stores that are directly passed into an entry point with a
mutable reference.

To count the remaining stores, I reference count both the results of the
loads and the address of the loads. If the results of a load has a
counter equal to 0 I remove that load instruction. I then keep track of
each removed address with its own reference counter. If the removed
loads counter is equal to the counter of the address of the loads, we
know we have removed all loads to an address and thus can safely remove
the store to that address.

We also added a check that store we want to remove is not used as an
argument into a function call.

I have added a unit test `remove_unused_loads_and_stores` inside of
`mem2reg.rs`.

The `brillig_loop_size_regression` test:
```noir
unconstrained fn main() -> pub Field {
    let mut emulated_enum = EnumEmulation { a: Option::some(1), b: Option::none(), c: Option::none() };

    for _ in 0..1 {
        assert_eq(emulated_enum.a.unwrap(), 1);
    }

    emulated_enum.a = Option::some(2);
    emulated_enum.a.unwrap()
}
```
now compiles to the optimal SSA after a single run of mem2reg:
```
After Mem2Reg:
brillig fn main f0 {
  b0():
    v1 = allocate
    v2 = allocate
    v3 = allocate
    v4 = allocate
    v5 = allocate
    v6 = allocate
    jmp b1(u32 0)
  b1(v0: u32):
    v8 = eq v0, u32 0
    jmpif v8 then: b3, else: b2
  b3():
    v11 = add v0, u32 1
    jmp b1(v11)
  b2():
    return Field 2
}
```

## Additional Context

There is most likely other ways we can utilize this per function state.
We can continue to iterate upon it in follow-ups.

## 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.

---------

Co-authored-by: Tom French <[email protected]>
Co-authored-by: jfecher <[email protected]>

nightly-2024-09-17: fix: let LSP suggest fields and methods in LValue chains (#6051)

17 Sep 02:13
5bf6567
Compare
Choose a tag to compare
# Description

## Problem

LSP autocompletion didn't trigger in some cases.

## Summary

Makes LSP autocompletion work when typing a dot but in the next line an
l-value assignment follows. In that case the current line and the line
that follows are parsed as a single assignment to an l-value and we must
complete in the middle of that entire expression.

## Additional Context

Also adds a missing `follow_bindings()` that caused some of these cases
to not work.

## 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.

v0.34.0

13 Sep 14:42
359caaf
Compare
Choose a tag to compare
v0.34.0 Pre-release
Pre-release

0.34.0 (2024-09-13)

⚠ BREAKING CHANGES

Features

Read more

nightly-2024-09-16: feat: add `Expr::as_for` and `Expr::as_for_range` (#6039)

16 Sep 02:30
abcae75
Compare
Choose a tag to compare
# Description

## Problem

Part of #5668

## Summary


## Additional Context



## Documentation

Check one:
- [ ] No documentation needed.
- [x] 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.