fix(ssa): Validate signed mul overflow#8798
Conversation
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'ACVM Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: d1dd840 | Previous: 9d44ab7 | Ratio |
|---|---|---|---|
perfectly_parallel_batch_inversion_opcodes |
3564172 ns/iter (± 1987) |
2778522 ns/iter (± 7503) |
1.28 |
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 'Test Suite Duration'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: a9d8f3c | Previous: 9d44ab7 | Ratio |
|---|---|---|---|
test_report_zkpassport_noir_rsa_ |
3 s |
2 s |
1.50 |
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 Time'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.20.
| Benchmark suite | Current: fd50edb | Previous: c2cedd4 | Ratio |
|---|---|---|---|
rollup-merge |
0.004 s |
0.003 s |
1.33 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @TomAFrench
| for function in ssa.functions.values() { | ||
| validate_function(function); | ||
| } |
There was a problem hiding this comment.
Why is this gone? (maybe it's already done somewhere else and this was redundant?)
There was a problem hiding this comment.
It was redundant. It was being done in FunctionBuilder::finish
Argh, I meant to type "!" instead of "?" 😅 |
Yes, I will add one. |
|
Added a test for a mul followed by a truncate with no cast. I also added a test that a lone truncate compiles: |
Description
Problem*
Resolves #8088
Builds upon #8765.
Summary*
This adds validation similar to #8706, except for signed multiplication. The semantics for which are seen here. We could be more strict with these checks by checking this code gen as well:
However, for now I have chosen to simply check up to the truncate point to simplify our "state machine". We also mainly want to guarantee that we have truncated the result of an operation appropriately so that someone cannot code gen an overflow.
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmton default settings.