From 79f71ec6fca0e093d27cb238d7c75dccb3a55d65 Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Thu, 15 Jul 2021 12:38:36 +0200 Subject: Abstract out non_null adjustments in ranger. There are 4 exact copies of the non-null range adjusting code in the ranger. This patch abstracts the functionality into a separate method. As a follow-up I would like to remove the varying_p check, since I have seen incoming ranges such as [0, 0xff....ef] which are not varying, but are not-null. Removing the varying restriction catches those. gcc/ChangeLog: * gimple-range-cache.cc (non_null_ref::adjust_range): New. (ranger_cache::range_of_def): Call adjust_range. (ranger_cache::entry_range): Same. * gimple-range-cache.h (non_null_ref::adjust_range): New. * gimple-range.cc (gimple_ranger::range_of_expr): Call adjust_range. (gimple_ranger::range_on_entry): Same. --- gcc/gimple-range-cache.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/gimple-range-cache.h') diff --git a/gcc/gimple-range-cache.h b/gcc/gimple-range-cache.h index ecf63dc..f842e9c 100644 --- a/gcc/gimple-range-cache.h +++ b/gcc/gimple-range-cache.h @@ -34,6 +34,8 @@ public: non_null_ref (); ~non_null_ref (); bool non_null_deref_p (tree name, basic_block bb, bool search_dom = true); + bool adjust_range (irange &r, tree name, basic_block bb, + bool search_dom = true); private: vec m_nn; void process_name (tree name); -- cgit v1.1