GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
match.pd Performance Win

match.pd: Rearrange (VCE (BFR)) simplification conditions

The compiler now correctly handles view conversions from bit-fields to integer types by adding a type precision check in match.pd.

This commit fixes an issue in GCC’s pattern matching (match.pd) related to view conversions from bit-fields. The precondition for (view_convert (BIT_FIELD_REF)) simplification was incorrect, allowing conversions between vector types and _BitInt types where precision could be smaller than size. The fix adds a type_has_mode_precision_p() check for all integer types, ensuring correct handling of these conversions.

In Details

The match.pd file defines pattern matching rules for GCC's tree optimizer. This commit corrects a simplification involving view_convert (BIT_FIELD_REF) by adding type_has_mode_precision_p() to ensure correct handling of conversions between bit-fields and integer types, particularly _BitInt. This addresses PR125259.

For Context

The compiler uses pattern matching to identify opportunities for simplification and optimization. This commit fixes a specific pattern in GCC related to how the compiler handles conversions from bit-fields (variables that use a specific number of bits) to other integer types. The fix ensures that the compiler correctly checks the precision of the types involved, preventing potential errors and improving code generation.

Filed Under: optimizationmatch.pdbit-fieldstype conversion