GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
sched-rgn Performance Win

sched-rgn: Correctly count non-debug instructions in region size estimates.

Fixes region scheduling to accurately count non-debug instructions, resolving over-subtraction issues with notes and improving region size estimation.

The sched-rgn pass incorrectly estimated the number of non-debug instructions in a code region, particularly when notes followed the last non-debug instruction. This commit modifies the estimation to directly count non-debug instructions, fixing an issue where debug instructions were subtracted too many times and improving accuracy for regions containing only debug code. This resolves PR128860.

In Details

The rgn_estimate_number_of_insns function in sched-rgn calculates the size of code regions for instruction scheduling. It previously used a Line Number Information (LUID) span and subtracted debug instructions. This method over-subtracted debug instructions when a note followed the last non-debug instruction in a block. The fix directly counts non-debug instructions, yielding a more accurate size estimate and resolving PR128860.

For Context
sched-rgn
A GCC pass responsible for instruction scheduling within code regions, aiming to improve execution performance by reordering instructions.
LUID
Likely refers to a Line Number Information (LNI) or similar mechanism that tracks instruction positions, possibly at a finer granularity than source lines.
note
In the context of assembly or object files, a 'note' section or entry contains metadata or information not directly executable code, often used for debugging or linking.
Filed Under: optimizationschedulerbugfix