cgraph: Add assume_function field to cgraph_node
cgraph_node gains an 'assume_function' field to preserve function attributes across LTO, fixing ICF.
A new assume_function field has been added to the cgraph_node structure to store information that was previously only available in the struct function. This is particularly important for Link-Time Optimization (LTO) where struct function might not always be present. The Intelligent Code Grouping (ICF) pass has been updated to consider this new field, preventing merging of functions with differing assume_function values.
In Details
This change adds assume_function to cgraph_node, mirroring the field in struct function. This is necessary for LTO builds where struct function is not always available. The cgraph representation needs to retain this information for subsequent passes. Specifically, ipa-icf.cc now hashes and checks this field in sem_function::get_hash, equals_wpa, and equals_private to prevent incorrect merging of functions that should be distinct based on this attribute.
- cgraph
- GCC's internal graph representation of functions and their relationships within a compilation unit.
- cgraph_node
- A node in the cgraph, typically representing a function or a procedure.
- LTO
- Link-Time Optimization. A compiler optimization technique where the entire program is optimized together during the linking phase, rather than optimizing each object file individually.
- ICF
- Identical Code Folding. A pass that merges identical functions or data into a single copy to reduce code size.
- assume_function
- A flag or attribute indicating assumptions made about a function, potentially related to its properties or behavior.