Ignore debug instructions in noce lifetime check.
Prevents debug instructions from incorrectly suppressing if-conversion optimizations.
This commit corrects the noce lifetime check to ignore debug instructions that mention variables but do not represent ordinary uses. Such debug-only payloads were inadvertently suppressing the min/max if-conversion optimization. By excluding these debug instructions from the overlap scan, the compiler can now properly apply if-conversion even when debug information is present.
In Details
The noce_lifetime_check in ifcvt was too conservative, considering DEBUG_INSN VAR_LOCATION mentions of if_info->x as ordinary uses. This could lead to suppression of min/max if-conversions. The change excludes these debug instructions from the overlap scan, ensuring that only actual variable modifications trigger suppression, thereby allowing optimizations to proceed when only debug information is present.
- ifcvt
- Conditional If Conversion, an optimization pass that transforms conditional branches into conditional instructions (e.g., conditional move or select) to improve performance.
- noce
- Near-Optimal Conditional Execution, likely a specific pass or technique within GCC related to if-conversion or instruction scheduling.
- lifetime check
- A process used by compilers to track the validity and usage of variables or registers throughout a program's execution, often related to optimization and register allocation.
- DEBUG_INSN
- An internal representation in GCC for instructions generated solely for debugging information, not for program execution.