backthreader: split out back_threader_profitability::account_bb
Backthreader's block accounting logic is extracted into a new function for clarity.
The logic for accounting a basic block’s statistics within the backthreader’s profitability analysis has been extracted into a new account_bb function. This change improves code organization by isolating the block-specific processing, and introduces an m_unprofitable_bb flag to signal unthreadable blocks.
In Details
This commit refactors tree-ssa-threadbackward.cc by extracting the loop body responsible for accumulating statistics for a single basic block into a new member function, back_threader_profitability::account_bb. The previous mechanism for handling unthreadable blocks, which involved a bailout within the loop, is replaced by setting an m_unprofitable_bb flag. This flag persists after the call, simplifying the control flow for determining path profitability.
- backthreader
- A GCC optimization pass that reorders instructions to improve parallelism. It analyzes execution paths to determine the most profitable reordering strategies.
- basic block
- A contiguous sequence of zero or more three-address instructions in which control enters at the beginning and leaves at the end without halt or possibility of branching except at the end.
- function extraction
- The process of taking a block of code from within one function and creating a new, separate function for it. This improves modularity and readability.