diff options
author | Martin Sebor <msebor@redhat.com> | 2022-02-03 13:58:28 -0700 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2022-02-03 13:58:28 -0700 |
commit | a62b740d7b8bff2d8b5578d01d00e5fe464e5325 (patch) | |
tree | c221ed0d97a1b5db66a48bc80773edab0fb1e602 /gcc/gimple-array-bounds.cc | |
parent | 68e9b7b69a1d36ff86c54d52fba034737d9433c3 (diff) | |
download | gcc-a62b740d7b8bff2d8b5578d01d00e5fe464e5325.zip gcc-a62b740d7b8bff2d8b5578d01d00e5fe464e5325.tar.gz gcc-a62b740d7b8bff2d8b5578d01d00e5fe464e5325.tar.bz2 |
Enable pointer_query caching in -Warray-bounds.
gcc/ChangeLog:
* gimple-array-bounds.cc (array_bounds_checker::array_bounds_checker):
Define ctor.
(array_bounds_checker::get_value_range): Use new member.
(array_bounds_checker::check_mem_ref): Same.
* gimple-array-bounds.h (array_bounds_checker::array_bounds_checker):
Outline ctor.
(array_bounds_checker::m_ptr_query): New member.
Diffstat (limited to 'gcc/gimple-array-bounds.cc')
-rw-r--r-- | gcc/gimple-array-bounds.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc index 80c70b4..7ec8b08 100644 --- a/gcc/gimple-array-bounds.cc +++ b/gcc/gimple-array-bounds.cc @@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see #include "tree.h" #include "gimple.h" #include "ssa.h" +#include "pointer-query.h" #include "gimple-array-bounds.h" #include "gimple-iterator.h" #include "gimple-walk.h" @@ -37,7 +38,13 @@ along with GCC; see the file COPYING3. If not see #include "domwalk.h" #include "tree-cfg.h" #include "attribs.h" -#include "pointer-query.h" + +array_bounds_checker::array_bounds_checker (struct function *func, + range_query *qry) + : fun (func), m_ptr_qry (qry) +{ + /* No-op. */ +} // This purposely returns a value_range, not a value_range_equiv, to // break the dependency on equivalences for this pass. @@ -45,7 +52,7 @@ along with GCC; see the file COPYING3. If not see const value_range * array_bounds_checker::get_value_range (const_tree op, gimple *stmt) { - return ranges->get_value_range (op, stmt); + return m_ptr_qry.rvals->get_value_range (op, stmt); } /* Try to determine the DECL that REF refers to. Return the DECL or @@ -401,7 +408,7 @@ array_bounds_checker::check_mem_ref (location_t location, tree ref, axssize = wi::to_offset (access_size); access_ref aref; - if (!compute_objsize (ref, m_stmt, 0, &aref, ranges)) + if (!m_ptr_qry.get_ref (ref, m_stmt, &aref, 0)) return false; if (aref.offset_in_range (axssize)) |