Ext-dce handles vector modes more conservatively
Extended dead code elimination now conservatively handles vector modes to prevent incorrect removal of code.
The extended dead code elimination (ext-dce) pass has been updated to handle vector modes more conservatively. A previous flaw in determining live bits for vector types led to the incorrect removal of code, specifically extensions, because the compiler wrongly assumed certain bits were never read. This change ensures more accurate liveness analysis for vector operations, preventing such optimizations from removing necessary code.
In Details
This commit revises vector mode handling in ext-dce, specifically addressing PR rtl-optimization/126426. The issue stemmed from GET_MODE_INNER incorrectly reporting the liveness of bits for vector types (e.g., V2HI). Instead of 0xffff, it should consider all bits (e.g., 0xffffffff). The fix involves a more conservative approach, particularly in carry_backpropagate, where vector modes are currently handled by broadcasting element liveness across the vector, avoiding incorrect dead code elimination that could remove extensions.
- ext-dce
- Extended Dead Code Elimination. A compiler optimization pass that removes code that does not affect the program's outcome.
- vector mode
- A data type in GCC's RTL (Register Transfer Language) that represents multiple elements of a smaller data type packed together, often used for SIMD operations.
- RTL
- Register Transfer Language. An intermediate representation used by GCC to represent program code during optimization.
- liveness analysis
- A data-flow analysis technique that determines which variables hold values that might be used in the future. This information is used for optimizations like dead code elimination and register allocation.
- GET_MODE_INNER
- A GCC internal macro used to get the mode of the inner elements of a vector or complex type.