Do not charge debug instructions against search budget
Debug instructions no longer affect redundant instruction search budget.
This change prevents debug instructions from consuming the search budget when looking for redundant instructions. By skipping DEBUG_INSNs, the compiler ensures that these non-executing instructions do not mask actual redundancies, leading to more accurate optimization. A new test case for SPARC is included.
In Details
This patch modifies the redundant_insn pass in reorg.cc to exclude DEBUG_INSNs from consuming the search budget. Previously, these debug instructions could decrement the budget, potentially causing the pass to miss actual redundancies in the code. The change ensures that only executable instructions affect the budget, improving the effectiveness of redundancy elimination.
- DEBUG_INSN
- A type of instruction used for debugging purposes, which does not execute during normal program runtime. These instructions are typically stripped out by the compiler before generating the final executable.
- redundant_insn
- A compiler pass that identifies and eliminates redundant instructions within the code to improve performance and reduce code size.
- search budget
- A limit set on the number of instructions the compiler will examine when searching for a specific pattern, such as a redundant instruction. This prevents the optimization pass from consuming excessive compile time.
- RTL
- Register Transfer Language. An intermediate representation used by GCC to represent the program before generating machine code. Optimization passes operate on RTL.