Skip to content

Conversation

@amanasifkhalid
Copy link
Contributor

Since every block is expected to have an execution count, compare this count to BB_ZERO_WEIGHT to determine if the block is rarely-run rather than maintaining a flag to indicate it. Fixes #48778.

Copilot AI review requested due to automatic review settings July 28, 2025 22:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_RARELY flag definition and all its usages
  • Update isRunRarely() method to check bbWeight == BB_ZERO_WEIGHT instead of the flag
  • Remove flag maintenance code that synchronized BBF_RUN_RARELY with 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

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 28, 2025
@amanasifkhalid
Copy link
Contributor Author

@dotnet/jit-contrib PTAL. No diffs. Thanks!

@amanasifkhalid amanasifkhalid merged commit 18ae5dd into dotnet:main Jul 29, 2025
110 checks passed
@amanasifkhalid amanasifkhalid deleted the remove-bbf-run-rarely branch July 29, 2025 13:24
@github-actions github-actions bot locked and limited conversation to collaborators Aug 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider fully replacing BBF_RUN_RARELY with the weight of 0

2 participants