IRA: Register allocation decision excludes debug instructions.
Register allocation decisions in IRA now ignore debug instructions, preventing unexpected code changes when debug info is enabled.
The Integrated Register Allocator (IRA) component’s decision to use the simple LRA (Local Register Allocation) now correctly excludes debug instructions. Previously, debug instructions consumed UIDs, potentially causing the threshold for simple LRA to be crossed and leading to different code generation. This change ensures the decision is based solely on the count of non-debug instructions.
In Details
The ira pass's heuristic for choosing between simple LRA and a more complex allocator (often based on instruction count) was using get_max_uid() which includes debug instructions. This commit switches it to get_max_insn_count(), which excludes them. This change prevents the presence of debug information from altering register allocation strategy, improving stability and predictability.
- IRA
- Integrated Register Allocator. A register allocation pass in GCC that aims to efficiently assign hardware registers to program variables.
- simple LRA
- A simplified version of the Local Register Allocator, likely used for smaller or simpler functions where a full-blown analysis might be overkill.
- UID
- Unique Identifier. In GCC's internal representation, UIDs are often assigned to instructions or basic blocks for tracking and analysis.
- debug information
- Metadata generated by the compiler (e.g., DWARF format) that allows debuggers to map executable code back to the original source code, enabling stepping through code, inspecting variables, etc.