bitintlower: Fix _BitInt SSA_NAME coalescing ICE [PR126447]
Fixes compiler ICE related to _BitInt SSA_NAME coalescing with abnormal PHI nodes.
This commit addresses an Internal Compiler Error (ICE) occurring in the bitintlower pass when handling _BitInt types and coalescing SSA_NAMEs. The issue arises when muldiv_p is incorrectly set to true for certain internal function calls, preventing the coalescing of the left-hand side (lhs) with its operands, particularly when operands are SSA_NAMEs involved in abnormal PHI nodes. The fix ensures that for such cases, new SSA_NAMEs are created for the operands, preventing coalescing failures and resolving the ICE.
In Details
This patch resolves an ICE in gimple_lower_bitint related to _BitInt type handling and SSA name coalescing. The build_bitint_stmt_ssa_conflicts function incorrectly sets muldiv_p to true for certain internal function calls (ifns) like muldiv_p, which then prevents the lhs from coalescing with input operands. When the lhs and operands have SSA_NAME_OCCURS_IN_ABNORMAL_PHI set, this leads to coalescing failures and an ICE. The fix mirrors the logic in gimple_lower_bitint for MULT_EXPR, creating new SSA names for operands present in abnormal PHI nodes to ensure they are coalesced…
- _BitInt
- A C++ feature allowing programmers to specify integer types with an arbitrary bit width at compile time, useful for low-level programming and hardware emulation where precise bit manipulation is required.
- SSA_NAME
- Static Single Assignment form name. In SSA form, every variable is assigned a value only once. SSA_NAMEs are used in GCC's intermediate representation to represent these unique variable assignments, facilitating compiler optimizations.
- Coalescing
- In compiler optimization, coalescing refers to the process of merging different variables or representations into a single one, typically to reduce register pressure or simplify code. In this context, it means ensuring that logically equivalent SSA names are mapped to the same underlying storage.
- PHI node
- A control flow graph construct used in SSA form. A PHI node at a basic block beginning indicates which value of a variable should be used, depending on which predecessor block executed. 'Abnormal PHI' refers to PHI nodes that present special challenges for optimization.
- gimple-lower-bitint
- A specific part of the GCC compiler (likely a function or pass) responsible for lowering (i.e., transforming) expressions involving
_BitInttypes into simpler operations understandable by the backend.