scev/niter: Use INTEGRAL_NB_TYPE_P instead of direct comparison to INTEGER_TYPE
GCC's loop analysis now uses a more robust check for integer types, improving compatibility with extended integer types.
GCC’s loop analysis now uses INTEGRAL_NB_TYPE_P to identify integer types instead of directly comparing against INTEGER_TYPE. This allows the compiler to correctly handle extended integer types (like bitint) during loop optimization. Using the proper macro ensures correct loop analysis and optimization, fixing a latent bug and improving code generation for loops using these types.
In Details
This patch modifies tree-scalar-evolution.cc and tree-ssa-loop-niter.cc to use INTEGRAL_NB_TYPE_P instead of directly comparing the tree code to INTEGER_TYPE. This change is necessary to correctly identify integer types, including extended integer types like bitint, during scalar evolution and loop iteration analysis. This affects loop optimization passes and ensures they can properly handle loops using non-standard integer types.
For Context
Modern compilers perform sophisticated analysis of loops to optimize their performance. One key aspect of this analysis is determining the number of times a loop will execute. This commit improves on integer type checking. By using a dedicated macro, INTEGRAL_NB_TYPE_P, rather than direct type comparison. This simplifies supporting other integer types.