public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Sebor <msebor@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-7035] Enable pointer_query caching in -Warray-bounds. Date: Thu, 3 Feb 2022 21:10:20 +0000 (GMT) [thread overview] Message-ID: <20220203211020.E0FFC385841A@sourceware.org> (raw) https://gcc.gnu.org/g:a62b740d7b8bff2d8b5578d01d00e5fe464e5325 commit r12-7035-ga62b740d7b8bff2d8b5578d01d00e5fe464e5325 Author: Martin Sebor <msebor@redhat.com> Date: Thu Feb 3 13:58:28 2022 -0700 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. Diff: --- gcc/gimple-array-bounds.cc | 13 ++++++++++--- gcc/gimple-array-bounds.h | 10 ++++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gcc/gimple-array-bounds.cc b/gcc/gimple-array-bounds.cc index 80c70b49607..7ec8b08c8d2 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)) diff --git a/gcc/gimple-array-bounds.h b/gcc/gimple-array-bounds.h index d42146b87c8..eb399271da7 100644 --- a/gcc/gimple-array-bounds.h +++ b/gcc/gimple-array-bounds.h @@ -20,13 +20,14 @@ along with GCC; see the file COPYING3. If not see #ifndef GCC_GIMPLE_ARRAY_BOUNDS_H #define GCC_GIMPLE_ARRAY_BOUNDS_H +#include "pointer-query.h" + class array_bounds_checker { friend class check_array_bounds_dom_walker; public: - array_bounds_checker (struct function *fun, range_query *v) - : fun (fun), ranges (v) { } + array_bounds_checker (struct function *, range_query *); void check (); private: @@ -38,8 +39,9 @@ private: /* Current function. */ struct function *fun; - /* Ranger instance. */ - range_query *ranges; + /* A pointer_query object to store information about pointers and + their targets in. */ + pointer_query m_ptr_qry; /* Current statement. */ gimple *m_stmt; };
reply other threads:[~2022-02-03 21:10 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220203211020.E0FFC385841A@sourceware.org \ --to=msebor@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).