IPA: Adjust jump function computations for callback edges
Jump function logic updated to handle internal callback edges for IPA analysis.
This commit modifies the jump function computation within the IPA pass to correctly handle internal callback edges. Previously, the logic relied on callback-carrying edges, which internal callbacks lack. The changes remap arguments for these edges and add an early return in get_dynamic_type to prevent issues with internal calls, ensuring IPA analysis can proceed for assume bodies.
In Details
The ipa_compute_jump_functions_for_edge function's logic for regular callback edges, which assumes a callback-carrying edge for remapping, is not applicable to internal callback edges (like those for IFN_ASSUME bodies). This patch introduces argument remapping specifically for these internal callback edges to enable ipa-cp to process assume bodies correctly. Additionally, ipa_polymorphic_call_context::get_dynamic_type is updated with an early return for IFN_ASSUME internal calls, as gimple_call_fn would not yield a valid called function.
- IPA
- Interprocedural Analysis. A suite of compiler passes that analyze and optimize code across function boundaries, rather than within a single function.
- jump function
- A mathematical function used in program analysis to describe the transformation of program state (like variable values) across a basic block or an edge in the control flow graph.
- callback edge
- A callgraph edge representing a function call that is invoked indirectly, often through a function pointer or a callback mechanism.
- internal callback edge
- A callgraph edge representing a call to an outlined function (like IFN_ASSUME bodies) that is not directly visible in the main call graph, differing from regular callback edges.
- IFN_ASSUME
- A special function or construct used in GCC, often related to outlining or assumptions made during interprocedural analysis, particularly for handling callback-like scenarios.
- ipa-cp
- The IPA (Interprocedural Analysis) Copy Propagation pass in GCC, responsible for propagating constants and values across function calls.