Centralize function-local address stripping in IPA analysis.
Consolidates handling of function-local addresses in pointer ranges to a central IPA function.
Inter-procedural analysis (IPA) previously had duplicate code for handling function-local addresses within pointer ranges. This commit centralizes this logic into a new method prange::clear_function_local_addr and moves its invocation to ipa_get_value_range. This refactoring removes special-case code from other IPA functions, simplifying the analysis and ensuring consistent treatment of local addresses.
In Details
IPA's value range analysis was manually stripping function-local addresses from prange objects in multiple locations (ipa_get_value_range_1, ipa_set_jfunc_vr, ipa_record_return_value_range_1). This commit introduces a unified prange::clear_function_local_addr method and calls it from a single entry point, ipa_get_value_range. This change centralizes the logic for removing LABEL_DECLs and other function-local address markers, preventing redundant code and potential inconsistencies.
- IPA
- Inter-procedural Analysis. Compiler analysis that considers information from across multiple functions, not just within a single function.
- pointer range
- Represents the possible values or addresses a pointer can take. This is used in compiler analysis to understand pointer behavior.
- prange
- GCC's internal structure for representing pointer ranges during analysis.
- function-local address
- An address that is only valid within the scope of a specific function, such as a label declaration or the address of a function-local variable.