diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2020-10-28 16:41:15 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2020-10-28 22:02:45 -0400 |
commit | 0162d00d12be24ee3f02ce876adafeaa91c6f7f9 (patch) | |
tree | 6ba997f13de10d9e7e4e7ffc8189b5508ae94f89 /gcc/gimple-range-cache.cc | |
parent | c6bfc4eb3c961181912647781d7dd38057db655b (diff) | |
download | gcc-0162d00d12be24ee3f02ce876adafeaa91c6f7f9.zip gcc-0162d00d12be24ee3f02ce876adafeaa91c6f7f9.tar.gz gcc-0162d00d12be24ee3f02ce876adafeaa91c6f7f9.tar.bz2 |
Call infer_non_null() directly when checking for non-null.
Simply call infer_non_null directly and avoid uneccessary checks of
the statement being modified.
gcc/
PR tree-optimization/97609
* gimple-range-cache.cc (non_null_ref::process_name): Call
infer_nonnull_range directly instead of infer_value_range.
gcc/testsuite/
* g++.dg/pr97609.C: New.
Diffstat (limited to 'gcc/gimple-range-cache.cc')
-rw-r--r-- | gcc/gimple-range-cache.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/gcc/gimple-range-cache.cc b/gcc/gimple-range-cache.cc index 13b9933..bc9243c 100644 --- a/gcc/gimple-range-cache.cc +++ b/gcc/gimple-range-cache.cc @@ -91,19 +91,15 @@ non_null_ref::process_name (tree name) { gimple *s = USE_STMT (use_p); unsigned index = gimple_bb (s)->index; - tree value; - enum tree_code comp_code; // If bit is already set for this block, dont bother looking again. if (bitmap_bit_p (b, index)) continue; - // If we can infer a != 0 range, then set the bit for this BB - if (infer_value_range (s, name, &comp_code, &value)) - { - if (comp_code == NE_EXPR && integer_zerop (value)) - bitmap_set_bit (b, index); - } + // If we can infer a nonnull range, then set the bit for this BB + if (!SSA_NAME_OCCURS_IN_ABNORMAL_PHI (name) + && infer_nonnull_range (s, name)) + bitmap_set_bit (b, index); } m_nn[v] = b; |