Add visit budget checks to IsMonotonicallyIncreasing and ComputeDoesOverflow#125156
Draft
Add visit budget checks to IsMonotonicallyIncreasing and ComputeDoesOverflow#125156
Conversation
Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add budget checks to IsMonotonicallyIncreasing and ComputeDoesOverflow
Add visit budget checks to IsMonotonicallyIncreasing and ComputeDoesOverflow
Mar 4, 2026
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
This was referenced Mar 4, 2026
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.
IsMonotonicallyIncreasingandComputeDoesOverflowlacked them_nVisitBudgetguard thatComputeRangealready uses, allowing unbounded recursion cost in pathological cases.Description
Added early-exit budget checks to both functions, consistent with the existing pattern in
ComputeRange:IsMonotonicallyIncreasing:falseis the conservative result ("not proven monotonic"), so this is safe to return when over budget.ComputeDoesOverflow:false("doesn't overflow") is slightly optimistic in isolation, butComputeRangeindependently returnsUnknownwhen over budget, which already blocks bounds-check elimination — so no unsound optimization can occur.Both checks are placed before
GetSearchPath()->Set(...)to avoid leaving stale entries in the search path on early exit.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.