GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
tree-ssa-ccp

tree-ssa-ccp: Correctly handle __builtin_bitreverse*.

Fixes bitwise constant propagation (CCP) for `__builtin_bitreverse*` intrinsics.

This commit corrects the handling of __builtin_bitreverse* builtins in the tree-ssa-ccp pass. It ensures that bitwise constant propagation (CCP) correctly handles bit reversal, which requires bit-reversing the value and mask constants, unlike byte swapping where the value and mask are bswapped.

In Details

The tree-ssa-ccp pass performs constant propagation. This commit fixes an error in how BUILT_IN_BITREVERSE* intrinsics were handled, ensuring that constants are bit-reversed rather than byte-swapped during propagation. This correction is crucial for the correctness of optimizations based on CCP.

For Context

Constant propagation is an optimization technique where the compiler replaces variables with their known constant values. This commit fixes a bug in how the compiler handles bit-reversal operations during constant propagation. By correctly propagating constant values through bit-reversal operations, the compiler can further optimize code and improve performance.

Filed Under: optimizationbitreverseconstant propagation