diff options
author | Martin Jambor <mjambor@suse.cz> | 2024-12-17 11:17:14 +0100 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2024-12-17 11:19:36 +0100 |
commit | 5d740f56a162702a33379789a4d6134d9733aa71 (patch) | |
tree | 2e9b473909e8862ef5213db6e7bf900d336a0c6c /gcc/tree-inline.h | |
parent | 1eb41aeb49a491f5b18d160074e651a76afc655a (diff) | |
download | gcc-5d740f56a162702a33379789a4d6134d9733aa71.zip gcc-5d740f56a162702a33379789a4d6134d9733aa71.tar.gz gcc-5d740f56a162702a33379789a4d6134d9733aa71.tar.bz2 |
ipa: Improve how we derive value ranges from IPA invariants
I believe that the current function ipa_range_set_and_normalize lacks
a check that a base of an ADDR_EXPR lacks a test whether the base
really cannot be NULL, so this patch adds it. Moreover, I never liked
the name as I do not think it makes the value of ranges any more
normal but rather just special-cases non-zero ip_invariant pointers.
Therefore, I have given it a different name and moved it to a .cc
file, our LTO bootstrap should inline (and/or split) it if necessary
anyway.
Because, as Honza correctly pointed out, deriving non-NULLness from a
pointer depends on flag_delete_null_pointer_checks which is an
optimization flag and thus depends on a given function, in this
version of the patch ipa_get_range_from_ip_invariant gets a
context_node parameter for that purpose. This then needs to be used
within symtab_node::nonzero_address which gets a special overload in
which the value of the flag can be provided as a parameter.
gcc/ChangeLog:
2024-12-11 Martin Jambor <mjambor@suse.cz>
* cgraph.h (symtab_node): Add a new overload of nonzero_address.
* symtab.cc (symtab_node::nonzero_address): Add a new overload whith a
parameter for delete_null_pointer_checks. Make the original overload
call the new one which has retains the actual implementation.
* ipa-prop.h (ipa_get_range_from_ip_invariant): Declare.
(ipa_range_set_and_normalize): Remove.
* ipa-prop.cc (ipa_get_range_from_ip_invariant): New function.
(ipa_range_set_and_normalize): Remove.
* ipa-cp.cc (ipa_vr_intersect_with_arith_jfunc): Add a new parameter
context_node. Use ipa_get_range_from_ip_invariant instead of
ipa_range_set_and_normalize and pass to it the new parameter.
(ipa_value_range_from_jfunc): Pass cs->caller as the context_node to
ipa_vr_intersect_with_arith_jfunc.
(propagate_vr_across_jump_function): Likewise.
(ipa_get_range_from_ip_invariant): New function.
* ipa-fnsummary.cc (evaluate_conditions_for_known_args): Use
ipa_get_range_from_ip_invariant instead of ipa_range_set_and_normalize
Diffstat (limited to 'gcc/tree-inline.h')
0 files changed, 0 insertions, 0 deletions