diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2021-09-27 18:53:54 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2021-10-06 09:11:50 -0400 |
commit | 4b8ca6c6177b2bd948c1cb2a116955b942751559 (patch) | |
tree | ded96deed7cd8fae6d1c4fe7461235e0c01c402c /gcc | |
parent | 90c3a62272313bb08cd5d9a948ff2d71af73b294 (diff) | |
download | gcc-4b8ca6c6177b2bd948c1cb2a116955b942751559.zip gcc-4b8ca6c6177b2bd948c1cb2a116955b942751559.tar.gz gcc-4b8ca6c6177b2bd948c1cb2a116955b942751559.tar.bz2 |
Ranger: More efficient zero/nonzero check.
A recent change introduced a frequent check for zero and non-zero which has
caused a lot of extra temporary trees to be created. Make the check more
efficent as it is always a pointer and thus unsigned.
* gimple-range-cache.cc (non_null_ref::adjust_range): Check for
zero and non-zero more efficently.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/gimple-range-cache.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index 61043d3..91dd5a5 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -98,9 +98,10 @@ non_null_ref::adjust_range (irange &r, tree name, basic_block bb, return false; // We only care about the null / non-null property of pointers. - if (!POINTER_TYPE_P (TREE_TYPE (name)) || r.zero_p () || r.nonzero_p ()) + if (!POINTER_TYPE_P (TREE_TYPE (name))) + return false; + if (r.undefined_p () || r.lower_bound () != 0 || r.upper_bound () == 0) return false; - // Check if pointers have any non-null dereferences. if (non_null_deref_p (name, bb, search_dom)) { |