simplify-rtx: Fix ICE in the VEC_CONCAT halves fold.
Fixes an internal compiler error when simplifying VEC_CONCAT operations involving UNSPECs.
An Internal Compiler Error (ICE) in the simplify_binary_operation_1 function has been fixed. The issue occurred when simplifying VEC_CONCAT operations where gen_lowpart was called on an UNSPEC type, which it did not support. The fix replaces gen_lowpart with rtl_hooks.gen_lowpart_no_emit, which is safer and does not emit instructions, preventing the ICE and ensuring correct handling of vector concatenations involving specific machine instructions.
In Details
An ICE in simplify_binary_operation_1 when folding VEC_CONCAT operands has been resolved. The problematic scenario arises when get_ref_base_and_offset returns an UNSPEC for the operand that gen_lowpart is expected to process. Since gen_lowpart asserts against UNSPEC modes, this leads to an ICE. The fix replaces the direct call to gen_lowpart with rtl_hooks.gen_lowpart_no_emit, mirroring the approach in other simplifications within simplify-rtx. This hook is designed to avoid emitting instructions and handles UNSPEC types gracefully, preventing the ICE.
- ICE
- Internal Compiler Error. A condition where the compiler encounters an unexpected state or error during its execution and terminates abnormally.
- RTL
- Register Transfer Language. An intermediate representation used by GCC to represent code before it is translated into machine code. It operates on registers and memory locations.
- VEC_CONCAT
- An RTL construct representing the concatenation of two vector halves into a larger vector. This is common in SIMD (Single Instruction, Multiple Data) operations.
- UNSPEC
- An RTL construct representing a machine-specific operation that does not have a direct generic equivalent. It's used for operations like specific loads or stores that have unique behavior.
- gen_lowpart
- An RTL function that extracts the lower part of a given RTL expression, typically used when dealing with larger data types split into smaller pieces.