GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
tree Performance Win

tree: Avoid building zero trees for poly_int coefficients

Optimizes poly_int coefficient conversion, reducing compiler self-cost.

This change optimizes the conversion of integer constants to poly_int coefficients by returning a cached integer_zero_node instead of repeatedly building a new zero tree. On targets like AArch64 and RISC-V, these conversions are frequent within alias analysis, and this optimization reduces compiler instruction count by about 1-2% on C++ codebases, leading to faster compile times.

In Details

On targets with NUM_POLY_INT_COEFFS > 1, wi::to_poly_offset and wi::to_poly_widest use wi::ints_for<...>::zero to fill trailing coefficients. For extended_tree, this previously called build_zero_cst, which involved a cache lookup for every INTEGER_CST. This commit changes this to return integer_zero_node directly, as extended_tree has a fixed precision and any zero `INTEGER_CST suffices. The unextended tree variant remains unchanged.

Filed Under: optimizationperformanceaarch64risc-v