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

i386: Implement TARGET_IRA_LOOP_REGION_FLATTEN_COST for APX

Improves register allocation for APX by preserving loop regions with frequent calls.

This commit enables the TARGET_IRA_LOOP_REGION_FLATTEN_COST hook for the i386 architecture, specifically for the APX instruction set. This allows the instruction register allocation (IRA) pass to keep loop regions with a single entry and exit as separate regions when their internal calls are more frequent than the surrounding move instructions. This is particularly beneficial for APX, where most general-purpose registers are call-clobbered, thus improving register pressure management.

In Details

This patch implements the TARGET_IRA_LOOP_REGION_FLATTEN_COST target hook for i386, targeting the APX instruction set extension. The hook's purpose is to allow targets to define custom logic for deciding whether to flatten a loop region into its parent region during instruction register allocation (IRA). For APX, where general registers are largely call-clobbered, it's beneficial to keep loops with frequent internal calls as distinct IRA regions if the call frequency outweighs the cost of moves at the loop's borders. This is achieved by providing a custom cost function in `ix86_ira_loop_reg…

For Context
i386
The original 32-bit Intel x86 microprocessor architecture.
APX
An instruction set extension for x86 processors, likely referring to the Advanced Performance Extensions or a similar feature set that enhances performance, often with changes to register usage or instruction capabilities.
IRA
Instruction Register Allocation, a phase in the compiler that assigns physical registers to virtual registers (pseudos).
loop region
A contiguous block of code within a loop that is treated as a single unit for certain optimization or analysis passes.
call-clobbered
Registers that a function is allowed to modify, meaning their values are not preserved across a function call and must be saved by the caller if needed.
Filed Under: i386iraregister allocationoptimizationapx