Skip to content

Conversation

@mkannwischer
Copy link
Contributor

To reduce stack usage, polyveck_decompose should be able to operate on one of the outputs aliasing the input. This is already fully supported but wasn't used to ease CBMC proofs/contracts at a cost of requiring additional stack space which is undesirable.

This commit is an alternative to
#792 which extended the CBMC contracts to allow aliasing.

This commit instead, changes the signature of the decompose functions to take 2 arguments instead of 3, where the second output also acts as and input. The corresponding poly_ and native functions are adjusted accordingly. CBMC contracts/proofs and unit tests are adjusted to the new signature. The single callsite of polyveck_decompose is adjusted.

@mkannwischer mkannwischer marked this pull request as ready for review December 17, 2025 05:35
@mkannwischer mkannwischer requested a review from a team as a code owner December 17, 2025 05:35
Copy link
Contributor

@hanno-becker hanno-becker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor points on readability and documentation, otherwise LGTM

To reduce stack usage, polyveck_decompose should be able to operate on one
of the outputs aliasing the input. This is already fully supported but
wasn't used to ease CBMC proofs/contracts at a cost of requiring additional
stack space which is undesirable.

This commit is an alternative to
#792
which extended the CBMC contracts to allow aliasing.

This commit instead, changes the signature of the decompose functions to
take 2 arguments instead of 3, where the second output also acts as and input.
The corresponding poly_ and native functions are adjusted accordingly.
CBMC contracts/proofs and unit tests are adjusted to the new signature.
The single callsite of polyveck_decompose is adjusted.

Signed-off-by: Matthias J. Kannwischer <[email protected]>
@hanno-becker hanno-becker merged commit 86496ce into main Dec 17, 2025
328 checks passed
@hanno-becker hanno-becker deleted the stack-decompose branch December 17, 2025 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants