Merged
Conversation
yuri91
requested changes
Feb 2, 2026
Changed the old logic so instead of keeping track globally of how many instructions have been visited for a given function. We keep this counter per function class and reset it for every new call site. If we have visited more than the maximum number of instructions, we can decide to not continue visiting this call site.
f065a69 to
c79e74d
Compare
added 3 commits
February 3, 2026 11:42
During the recursive visit of a function call site, when we mark blocks as visited, we insert them into a data structure that tracks the visited blocks across the different call sites. If at any point, the size of the visited blocks is the same as the size of a funciton, that means that there is no point in trying to find unreachable blocks in any further visit to another call site of that function.
We were previously using the limit for the maximum number of visits per basic blocks for bailing out on to many call sites for a function which was not clear.
Instead of a check for the maximum number of basic blocks, we track if we have visited too many instruction for a SCC. If that is the case we mark the basic blocks as visited, reset the counter of instructions per SCC and continue
c79e74d to
db3f430
Compare
yuri91
approved these changes
Feb 3, 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.
Made two new changes:
Changed the previous logic for tracking the number of instructions visited for a function. Before we used to have a global tracker, that when we had reached the max number of instructions, we would skip on any future instruction for all call sites. This I think was wrong because we want to track instructions per call site and not across all of them. Now if reach the maximum number of instructions we can bail out for that call site but maybe with a different call site we can still find optimizations.
Added a set that stores visited basic blocks across a function's call sites and a counter that has the total number of blocks for a function. If the size of the set ever is the same as the total number blocks, there is no point in continuing with any other call site.