Fold jump functions after inlining for IPA.
Improves interprocedural analysis by folding constant and ancestor jump functions after inlining.
This commit enhances interprocedural analysis (IPA) by improving how jump functions are composed after inlining. It now correctly folds constant jump functions into ancestor jump functions and handles arithmetic pass-through items, resolving limitations in previous logic. This leads to more accurate analysis of program flow and potential optimizations.
In Details
The ipa-cp pass in GCC performs interprocedural analysis and optimization. update_jump_functions_after_inlining is a crucial function that composes jump functions from caller and callee contexts after an inlining decision. This patch fixes two cases: 1) it correctly computes the ancestor jump function when the predecessor is a constant pointer (IPA_JF_CONST), using ipa_get_jf_ancestor_result, and 2) it handles arithmetic IPA_JF_PASS_THROUGH items by using ipa_get_jf_arith_result, extending the pass-through logic beyond NOP_EXPR. These changes are tested with new cases `iinline-cst…
- Interprocedural Analysis (IPA)
- A type of program analysis that considers the entire program, including all functions, to understand call relationships and data flow. This allows for optimizations that span across function calls.
- inlining
- An optimization technique where the code of a called function is directly inserted into the body of the calling function, eliminating function call overhead and enabling further optimizations.
- jump function
- A representation used in program analysis to describe the possible values or states of variables at different control flow points in a program. They are used to track information across function calls and inlining.
- IPA_JF_CONST
- A type of jump function indicating that a value is a constant.
- IPA_JF_ANCESTOR
- A type of jump function representing a value that is an ancestor of the current point in the call stack.
- IPA_JF_PASS_THROUGH
- A type of jump function indicating that a value passes through unchanged.
- NOP_EXPR
- A 'No Operation' expression, often used as a placeholder or in control flow that does not modify program state.