tree-optimization/126159 - Handle unions in data dependence analysis
Improves data dependence analysis to handle non-aggregate union field accesses.
This commit enhances GCC’s data dependence analysis pass to correctly handle accesses to non-aggregate fields within unions. Previously, such accesses could be misinterpreted, potentially leading to incorrect optimization decisions. The changes ensure that accesses to union members, particularly when subsetting is not applied, are properly accounted for, improving the accuracy of data flow analysis.
In Details
This patch adds minimal handling for union accesses within the dr_analyze_indices function in tree-data-ref.cc. Specifically, it addresses accesses to non-aggregate fields of unions, especially those where additional subsetting is not performed. The access_fn_component_p function is adjusted accordingly. The goal is to improve the accuracy of data reference analysis, particularly for vectorization, by correctly modeling disjoint accesses within unions.
- data dependence analysis
- A compiler analysis that determines if one instruction's result is used by a subsequent instruction. This is crucial for instruction scheduling and parallelization, including vectorization.
- union
- A composite data type in C/C++ that can hold values of different data types at the same memory location. Only one member of a union can hold a value at any given time.
- vectorization
- An optimization technique where a single instruction operates on multiple data elements simultaneously, often by using special CPU instructions (SIMD).
- tree-data-ref.cc
- A GCC source file likely containing code for analyzing data references within the compiler's intermediate representation (tree).