Range analysis handles abnormal PHIs
GCC's range analysis no longer avoids SSA names in abnormal PHIs, allowing for more comprehensive analysis.
GCC’s range analysis has been updated to no longer restrict itself from analyzing SSA names that occur within abnormal PHI nodes. Previously, this restriction was in place due to a misunderstanding of the ‘abnormal’ marker, which pertains to transformation constraints rather than analysis limitations. The range analysis can now correctly determine value ranges even when PHIs are involved in abnormal control flow paths, as the core semantics of PHI and copy operations still hold. This change aims to improve the accuracy and completeness of range analysis.
In Details
The gimple_range_ssa_p function no longer rejects SSA names that occur in abnormal PHIs. This restriction, dating back to r12-4443-g93ac832f1846e4, was based on a misunderstanding that the 'abnormal' marker limited analysis. The marker actually constrains transformations (e.g., no copies on abnormal edges), but analysis itself is unaffected. The path_range_query::ssa_range_in_phi now asserts that the incoming path edge is not abnormal, ensuring correctness.
- Range analysis
- A compiler optimization technique that determines the possible range of values a variable can take at a particular point in the program. This information can be used for further optimizations.
- gimple_range_ssa_p
- A GCC internal function likely used in range analysis to check properties of SSA names within the GIMPLE intermediate representation.
- SSA name
- In GCC's Static Single Assignment (SSA) form, an SSA_NAME represents a variable that has been assigned a value exactly once. It's a core concept for many compiler optimizations.
- Abnormal PHI
- A PHI node where one of the incoming edges from a predecessor block is considered 'abnormal'. This typically relates to control flow constructs like computed gotos or exceptions.