Skip to content

Preserve required SSA evaluations#29573

Closed
1sgtpepper wants to merge 8 commits into
ProvableHQ:masterfrom
1sgtpepper:fix/29563-required-eval-roots-v2
Closed

Preserve required SSA evaluations#29573
1sgtpepper wants to merge 8 commits into
ProvableHQ:masterfrom
1sgtpepper:fix/29563-required-eval-roots-v2

Conversation

@1sgtpepper

Copy link
Copy Markdown
Contributor

Motivation

Fixes #29563.

This PR updates SSA constant propagation to track definitions whose evaluation must remain live even when their resulting value can no longer affect the final value.

The pass now carries required-evaluation roots through SSA paths and checks those roots before applying rewrites that drop an expression, including zero absorption, boolean absorption, self-comparison folding, ternary folding, and composite field forwarding.

Test Plan

Added regressions covering:

  • checked subtraction preserved through zero absorption;
  • required evaluation preserved through aliases and ternaries;
  • composite field forwarding only when it preserves required evaluation;
  • execution behavior for checked subtraction underflow.

Validated with:

  • cargo +nightly-x86_64-pc-windows-gnu fmt --check
  • cargo +1.96.0-x86_64-pc-windows-gnu clippy -p leo-passes --all-targets --locked -- -D warnings
  • focused SSA const-prop pass tests
  • focused ssa_checked_sub execution test

Related PRs

N/A

@1sgtpepper
1sgtpepper marked this pull request as ready for review July 3, 2026 04:56
@1sgtpepper
1sgtpepper marked this pull request as draft July 3, 2026 05:36
@1sgtpepper 1sgtpepper closed this Jul 15, 2026
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.

[Bug] SSA constant propagation erases checked subtraction failure

1 participant