reorg: Ignore debug insns between consecutive labels [PR127796]
Fixes a bug where debug instructions could hide labels, affecting branch redirection and causing test failures.
This commit resolves an issue in the RTL (Runtime Linearization) reordering phase where debug instructions between consecutive labels could be misinterpreted. The skip_consecutive_labels function previously treated debug instructions as regular instructions, causing it to stop prematurely and hide later labels. This could lead to incorrect branch redirection and mismatches in debug-related tests. The fix modifies the function to ignore debug instructions, ensuring correct label processing and passing associated regression tests.
In Details
Modifies reorg.cc:skip_consecutive_labels to correctly handle sequences of labels that may be separated by debug instructions. Previously, INSN_P would evaluate to true for DEBUG_INSNs, causing the scan to terminate prematurely and potentially hide subsequent labels. This change updates the condition to NONDEBUG_INSN_P, ensuring that the function scans past debug markers to find the next actual instruction, which is crucial for accurate branch target identification and avoiding debug-specific test regressions.
- RTL
- Register Transfer Language. An intermediate representation used in GCC for performing optimizations on low-level code.
- debug insns
- Instructions generated by the compiler specifically for debugging purposes, such as marking line numbers or variable scopes. These are typically discarded in optimized builds.
- label
- A marker in assembly or intermediate code that designates a specific location, often used as a target for branches or jumps.
- branch redirection
- The process of determining and updating the target address of a branch instruction, which can be affected by code layout changes.
- PR127796
- Problem Report number 127796, indicating a bug filed against the GCC compiler related to RTL optimization.