Widen on the local iteration count, as the C++ iterator does - #33
Open
arthaud wants to merge 1 commit into
Open
Conversation
`MonotonicFixpointIterator::extrapolate` is documented to apply the join
at the first iteration and the widening operator at every subsequent one,
which is what `MonotonicFixpointIteratorBase::extrapolate` does in the
C++ implementation:
if (context.get_local_iterations_for(node) == 0) {
current_state->join_with(new_state);
} else {
current_state->widen_with(new_state);
}
It read the global iteration count instead, which is never reset. `run`
already calls `reset_local_iteration_count_for` whenever a component
stabilizes, exactly as the C++ iterator does, but nothing read the count
back, so a component that stabilized and was then entered again with a
larger state was widened right away rather than joined once more.
The result is still a sound post-fixpoint, but it loses precision on
nested loops, where the inner component is re-entered every time the
outer one grows.
The new test covers this: its inner component stabilizes once before the
outer one grows `x`, so its head is extrapolated with a local iteration
count of 0 and a global one of 1. It fails before this change, with `z`
widened to top instead of holding {0, 5}.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FGo5pDipqSuWEHtiwYmxTx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MonotonicFixpointIterator::extrapolateis documented to apply the join at the first iteration and the widening operator at every subsequent one, which is whatMonotonicFixpointIteratorBase::extrapolatedoes in the C++ implementation:It read the global iteration count instead, which is never reset.
runalready callsreset_local_iteration_count_forwhenever a component stabilizes, exactly as the C++ iterator does, but nothing read the count back, so a component that stabilized and was then entered again with a larger state was widened right away rather than joined once more.The result is still a sound post-fixpoint, but it loses precision on nested loops, where the inner component is re-entered every time the outer one grows.
The new test covers this: its inner component stabilizes once before the outer one grows
x, so its head is extrapolated with a local iteration count of 0 and a global one of 1. It fails before this change, withzwidened to top instead of holding {0, 5}.