Combine pass rejects instructions with hard register constraints.
This commit prevents the combine pass from merging instructions that use hard register constraints, fixing code generation errors.
The combine pass in GCC was incorrectly merging instructions that used hard register constraints, leading to errors during code generation, such as the inability to find a register to spill. This commit prevents the combine pass from merging instructions when the resulting instruction would violate hard register constraints. This resolves issues where target-specific machine descriptions impose constraints on register usage.
In Details
The combine pass in GCC attempts to simplify and combine instructions to improve code efficiency. This commit addresses a bug where the combine pass would merge instructions even when the resulting instruction violated hard register constraints specified in the target's machine description. Specifically, the patch prevents combining instructions across a hard register assignment (reg:HI 22 r22). This fix prevents code generation errors, such as "unable to find a register to spill", that can occur when hard register constraints are violated. The issue was triggered by a machine description f…
For Context
The combine pass is a crucial optimization stage in GCC that simplifies and combines instructions to reduce code size and improve performance. Compilers sometimes need to enforce that certain values reside in specific hardware registers. This commit addresses an issue where the combine pass was ignoring these register constraints, leading to code generation failures. The fix ensures that the combine pass respects all register constraints, preventing errors and ensuring correct code generation for targets with specific hardware requirements.