GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
middle-end

Fix wrong alias set for BIT_FIELD_REF wrapped ref

Corrected alias set determination for BIT_FIELD_REF on loaded registers in GCC.

This change fixes an issue in GCC’s alias analysis where BIT_FIELD_REF on a register loaded from memory was assigned an incorrect alias set. The fix ensures that the alias set is correctly determined by first considering the TBAA-relevant parts of the access path before handling view-converted MEM_REFs.

In Details

The reference_alias_ptr_type_1 function in alias.cc incorrectly computed alias sets for BIT_FIELD_REFs that wrap register loads. This was due to a failure to prune the access path to only its TBAA-relevant components before applying special handling for view-converted MEM_REFs. This commit corrects the order of operations, ensuring accurate alias analysis for such constructs.

For Context
BIT_FIELD_REF
An intermediate representation in GCC that refers to a specific bitfield within a larger data structure or register.
alias set
In compiler optimization, an alias set groups memory references that might potentially refer to the same memory location. Accurate alias set management is crucial for enabling optimizations like dead code elimination and common subexpression elimination.
TBAA
Type-Based Alias Analysis. A technique used by compilers to determine memory access disambiguation based on type information, reducing the need for conservative assumptions about aliasing.
MEM_REF
An intermediate representation in GCC that represents a memory access.
Filed Under: optimizationalias analysis