Skip to content

Simplify branch hint instrumentation#8624

Open
tlively wants to merge 1 commit intomainfrom
branch-hint-transparent-instrument
Open

Simplify branch hint instrumentation#8624
tlively wants to merge 1 commit intomainfrom
branch-hint-transparent-instrument

Conversation

@tlively
Copy link
Copy Markdown
Member

@tlively tlively commented Apr 18, 2026

The previous branch hint instrumentation logic would introduce a scratch local to hold the condition so it could be passed into both the logging function and the original branching instruction. The de-instrumentation pass would then need to find this local and attempt to undo the data flow change. Simplify all of this by having the logging function return the condition value so it can interpose between the condition and the branch without any new locals. De-instrumentation can now just replace the call to the log function with its condition parameter.

To allow further simplification, also change the order of parameters to the logging function so the condition value is the first parameter. This ensures that we don't need to introduce a scratch local even when the condition is a pop, because the pop will remain the leftmost leaf expression in the catch body.

@tlively tlively requested a review from a team as a code owner April 18, 2026 04:26
@tlively tlively requested review from kripken and removed request for a team April 18, 2026 04:26
The previous branch hint instrumentation logic would introduce a scratch local to hold the condition so it could be passed into both the logging function and the original branching instruction. The de-instrumentation pass would then need to find this local and attempt to undo the data flow change. Simplify all of this by having the logging function return the condition value so it can interpose between the condition and the branch without any new locals. De-instrumentation can now just replace the call to the log function with its condition parameter.

To allow further simplification, also change the order of parameters to the logging function so the condition value is the first parameter. This ensures that we don't need to introduce a scratch local even when the condition is a `pop`, because the pop will remain the leftmost leaf expression in the catch body.
@tlively tlively force-pushed the branch-hint-transparent-instrument branch from 4356c25 to 1456ddf Compare April 18, 2026 04:36
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.

1 participant