Prevent ICE in lower-subreg by distinguishing CONCATN types.
Fix compiler crash related to register decomposition by better identifying temporary concatenations.
The lower-subreg optimization pass could encounter an ICE when processing pre-existing CONCATN (concatenation) subregisters. This was because the pass incorrectly attempted to decompose these, leading to assertions about inner modes being splittable. This commit enhances lower-subreg to distinguish between temporary CONCATNs it creates and those that already exist in the code.
A new flag is set on temporary CONCATNs, preventing them from being decomposed inappropriately and thus avoiding the compiler crash. This also includes updates to RTL structures and test cases for RVV.
In Details
The lower-subreg pass in GCC's RTL (Register Transfer Language) optimization pipeline is responsible for simplifying subregister accesses. It can decompose CONCATN subregisters, which represent concatenations of smaller register modes. The pass has logic specifically for handling CONCATNs it generates itself. However, when encountering pre-existing CONCATNs from other compiler passes (e.g., in rtl.h or from vector operations), it could trigger ICEs. This patch introduces a DECOMPOSED_REGISTER_P flag, similar to how volatil is used in var-tracking.cc, to mark CONCATNs created…
- RTL
- Register Transfer Language. An intermediate representation used by GCC after the initial tree-based optimizations, closer to machine instructions and register allocations.
- subregister
- A portion of a larger hardware register that can be accessed independently. Optimizations often manipulate subregisters to make efficient use of machine registers.
- CONCATN
- A GCC internal representation for a concatenation of two or more smaller values or register modes into a larger one. This is distinct from the simpler CONCAT in some contexts.
- ICE
- Internal Compiler Error. A bug within the compiler itself that causes it to crash during compilation.
- RVV
- RISC-V Vector extension. A set of instructions for performing operations on multiple data elements in parallel, similar to SIMD extensions on other architectures.