Skip to content

nightly-2024-09-28: feat(ssa): Simplify signed casts (#6166)

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 28 Sep 02:27
· 25 commits to master since this release
eec3a61
# Description

## Problem\*

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

Small optimization I noticed while working on other tasks.

## Summary\*

We currently simplify when casting to a field or an unsigned type. We
can also simplify when casting to a signed type. This is an initial
version that is quite conservative in the simplification. If we we have
a constant that is below `2^(bit_size-1)` when casting to a signed type
we return the constant with the new signed type. I also added the case
of signed -> field as this can be the same as going unsigned -> field.

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