JIT: Remove BBF_RUN_RARELY#118147
Merged
amanasifkhalid merged 7 commits intodotnet:mainfrom Jul 29, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR removes the BBF_RUN_RARELY flag from the JIT compiler and replaces its functionality by comparing the block's execution weight to BB_ZERO_WEIGHT. This simplifies the codebase by eliminating redundant flag management while maintaining the same logical behavior for identifying rarely-run blocks.
Key changes:
- Remove
BBF_RUN_RARELYflag definition and all its usages - Update
isRunRarely()method to checkbbWeight == BB_ZERO_WEIGHTinstead of the flag - Remove flag maintenance code that synchronized
BBF_RUN_RARELYwith zero weights - Introduce
bbSetRunRarely()method calls where appropriate
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/block.h | Removes BBF_RUN_RARELY flag definition, updates isRunRarely() implementation, removes flag synchronization in weight-setting methods |
| src/coreclr/jit/optimizer.cpp | Removes BBF_RUN_RARELY flag removal/setting code in weight management functions |
| src/coreclr/jit/importer.cpp | Replaces explicit weight and flag setting with bbSetRunRarely() call and removes flag copying |
| src/coreclr/jit/fgprofile.cpp | Removes flag synchronization when setting block weights |
| src/coreclr/jit/fgopt.cpp | Updates profile weight checks to use method calls instead of flag checks, removes flag setting |
| src/coreclr/jit/fginline.cpp | Removes BBF_RUN_RARELY exclusion when copying block flags |
| src/coreclr/jit/fgdiagnostic.cpp | Removes BBF_RUN_RARELY from debug output and validation |
| src/coreclr/jit/block.cpp | Removes BBF_RUN_RARELY from debug flag display |
| src/coreclr/jit/async.cpp | Replaces weight inheritance with direct bbSetRunRarely() call |
Co-authored-by: Copilot <[email protected]>
…alid/runtime into remove-bbf-run-rarely
Contributor
Author
|
@dotnet/jit-contrib PTAL. No diffs. Thanks! |
EgorBo
approved these changes
Jul 29, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Since every block is expected to have an execution count, compare this count to
BB_ZERO_WEIGHTto determine if the block is rarely-run rather than maintaining a flag to indicate it. Fixes #48778.