IPA-SRA adjusted for IFN_ASSUME bodies and callback edges
Adapts IPA-SRA to handle IFN_ASSUME bodies and correctly process callback edges.
This patch makes necessary adjustments to the IPA-SRA (Inter-Procedural Scalar Replacement) pass to correctly handle outlined assume bodies and callback edges. It modifies checks within functions that process internal calls and argument flows to accommodate IFN_ASSUME calls, ensuring correct index remapping. Additionally, assume bodies are special-cased regarding their return values, which should not be removed. The patch also includes checks to prevent optimization of assume bodies lacking callback edges and adjusts remapping for parameter descriptors and flows across callback edges.
In Details
This commit modifies ipa-sra.cc to better integrate IFN_ASSUME bodies and callback edges into the IPA-SRA optimization. Key changes include: ipa_sra_preliminary_function_checks now excludes assume bodies without callback edges from optimization. ptr_parm_has_nonarg_uses and scan_function are adjusted to let IFN_ASSUME calls pass through. isra_analyze_call special-cases m_return_ignored for assume bodies. retval_used_p is made to return true for assume bodies since their return value is used later. Various functions like param_removal_cross_scc_edge, `propagate_param_…
- IPA
- Inter-Procedural Analysis. GCC performs analysis and optimizations by looking at the entire program (all procedures) at once, rather than analyzing each procedure in isolation.
- IPA-SRA
- Inter-Procedural Scalar Replacement. An optimization pass within GCC's IPA framework that attempts to replace scalar memory references (like array elements or struct fields) with register variables, potentially improving performance.
- IFN_ASSUME call
- An internal GCC construct representing an assumption about program behavior, often used for optimization purposes. These do not typically appear in the final compiled code.
- callback edge
- An edge in the call graph that represents a function being called indirectly, often through a function pointer or a more complex mechanism. Internal callback edges are specific to GCC's internal representation.
- parameter descriptor
- A data structure within GCC that holds information about a function parameter, such as its type, name, and how it is used.