bpf/analyze: refactor reachability analysis and unused tail call elim#41875
Merged
giorio94 merged 11 commits intocilium:mainfrom Sep 25, 2025
Merged
bpf/analyze: refactor reachability analysis and unused tail call elim#41875giorio94 merged 11 commits intocilium:mainfrom
giorio94 merged 11 commits intocilium:mainfrom
Conversation
Contributor
Author
|
/test |
e40adb1 to
b67c431
Compare
Contributor
Author
|
/test |
b67c431 to
0b675e8
Compare
Contributor
Author
|
/test |
0b675e8 to
e5beea1
Compare
Contributor
Author
|
/test |
e5beea1 to
b67531a
Compare
Contributor
Author
|
/test |
This separates concerns and allows turning Blocks into an alias for []*Block. Signed-off-by: Timo Beckers <timo@isovalent.com>
This was temporarily a struct to add on reachability information, but this has now been factored out into its own thing. Also use a fast popcnt() for counting ones in a bitmap. Signed-off-by: Timo Beckers <timo@isovalent.com>
A follow-up commit will introduce a Block iterator that can step forwards and backwards randomly depending on the need. It will use this behaviour. Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
Signed-off-by: Timo Beckers <timo@isovalent.com>
This allows reusing reachables across dead map and tail call elimination. Signed-off-by: Timo Beckers <timo@isovalent.com>
This commit introduces a reachableSpec object that ties reachability information to a ProgramSpec, to avoid having to pass an extra reachability dict around. This is problematic since reachability is indexed by string, while tails are indexed by id and only include a subset of the CollectionSpec. Split up removeUnusedTailcalls() into discrete steps with clear in- and outputs to improve readability. Signed-off-by: Timo Beckers <timo@isovalent.com>
b67531a to
f3aa674
Compare
Contributor
Author
|
/test |
dylandreimerink
approved these changes
Sep 25, 2025
giorio94
approved these changes
Sep 25, 2025
Member
giorio94
left a comment
There was a problem hiding this comment.
/lgtm for the logfields change.
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.
Some readability and performance improvements that couldn't hold up the merge of the initial work.
In short:
BlockIteratorthat supports iterating forwards and backwards, as well as cloning for starting temporary backtracking sessions from the current instructionReachabletype to hold block reachability information, wrapping a Blocks and insnsFixes: #41628