]> git.ipfire.org Git - thirdparty/gcc.git/commit
Register non-null side effects properly.
authorAndrew MacLeod <amacleod@redhat.com>
Mon, 7 Feb 2022 20:52:16 +0000 (15:52 -0500)
committerAndrew MacLeod <amacleod@redhat.com>
Wed, 9 Feb 2022 14:09:54 +0000 (09:09 -0500)
commitc6bb1db76b3ac127aff7dacf391fc1798a94bb7d
treeece35b744603236671d2ee0e8cc8fdf1c8f06828
parentda2bf62d9e2a25f2d6a99176144c250b51fbdee7
Register non-null side effects properly.

This patch adjusts uses of nonnull to accurately reflect "somewhere in block".
It also adds the ability to register statement side effects within a block
for ranger which will apply for the rest of the block.

PR tree-optimization/104288
gcc/
* gimple-range-cache.cc (non_null_ref::set_nonnull): New.
(non_null_ref::adjust_range): Move to header.
(ranger_cache::range_of_def): Don't check non-null.
(ranger_cache::entry_range): Don't check non-null.
(ranger_cache::range_on_edge): Check for nonnull on normal edges.
(ranger_cache::update_to_nonnull): New.
(non_null_loadstore): New.
(ranger_cache::block_apply_nonnull): New.
* gimple-range-cache.h (class non_null_ref): Update prototypes.
(non_null_ref::adjust_range): Move to here and inline.
(class ranger_cache): Update prototypes.
* gimple-range-path.cc (path_range_query::range_defined_in_block): Do
not search dominators.
(path_range_query::adjust_for_non_null_uses): Ditto.
* gimple-range.cc (gimple_ranger::range_of_expr): Check on-entry for
def overrides.  Do not check nonnull.
(gimple_ranger::range_on_entry): Check dominators for nonnull.
(gimple_ranger::range_on_edge): Check for nonnull on normal edges..
(gimple_ranger::register_side_effects): New.
* gimple-range.h (gimple_ranger::register_side_effects): New.
* tree-vrp.cc (rvrp_folder::fold_stmt): Call register_side_effects.

gcc/testsuite/
* gcc.dg/pr104288.c: New.
gcc/gimple-range-cache.cc
gcc/gimple-range-cache.h
gcc/gimple-range-path.cc
gcc/gimple-range.cc
gcc/gimple-range.h
gcc/testsuite/gcc.dg/pr104288.c [new file with mode: 0644]
gcc/tree-vrp.cc