public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1761] analyzer: don't track string literals in the store [PR106359]
Date: Wed, 20 Jul 2022 00:23:40 +0000 (GMT)	[thread overview]
Message-ID: <20220720002340.A534E3858D37@sourceware.org> (raw)

https://gcc.gnu.org/g:68871a008e686dbe56ff0b502f2864176a140716

commit r13-1761-g68871a008e686dbe56ff0b502f2864176a140716
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Tue Jul 19 20:22:18 2022 -0400

    analyzer: don't track string literals in the store [PR106359]
    
    Doing so speeds up -fanalyzer from taking over 4 hours to under a
    minute on the Linux kernel's sound/soc/codecs/cs47l90.c
    
    gcc/analyzer/ChangeLog:
            PR analyzer/106359
            * region.h (string_region::tracked_p): New.
            * store.cc (binding_cluster::binding_cluster): Move here from
            store.h.  Add assertion that base_region is tracked_p.
            * store.h (binding_cluster::binding_cluster): Move to store.cc.
    
    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

Diff:
---
 gcc/analyzer/region.h | 4 ++++
 gcc/analyzer/store.cc | 7 +++++++
 gcc/analyzer/store.h  | 4 +---
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gcc/analyzer/region.h b/gcc/analyzer/region.h
index 60d8149f513..fd0d4a05cc9 100644
--- a/gcc/analyzer/region.h
+++ b/gcc/analyzer/region.h
@@ -1151,6 +1151,10 @@ public:
 
   void dump_to_pp (pretty_printer *pp, bool simple) const final override;
 
+  /* We assume string literals are immutable, so we don't track them in
+     the store.  */
+  bool tracked_p () const final override { return false; }
+
   tree get_string_cst () const { return m_string_cst; }
 
 private:
diff --git a/gcc/analyzer/store.cc b/gcc/analyzer/store.cc
index 06151d8c041..e3dabf300df 100644
--- a/gcc/analyzer/store.cc
+++ b/gcc/analyzer/store.cc
@@ -1103,6 +1103,13 @@ binding_map::remove_overlapping_bindings (store_manager *mgr,
 
 /* class binding_cluster.  */
 
+binding_cluster::binding_cluster (const region *base_region)
+: m_base_region (base_region), m_map (),
+  m_escaped (false), m_touched (false)
+{
+  gcc_assert (base_region->tracked_p ());
+}
+
 /* binding_cluster's copy ctor.  */
 
 binding_cluster::binding_cluster (const binding_cluster &other)
diff --git a/gcc/analyzer/store.h b/gcc/analyzer/store.h
index 368b2990ae8..9b54c7b9156 100644
--- a/gcc/analyzer/store.h
+++ b/gcc/analyzer/store.h
@@ -544,9 +544,7 @@ public:
   typedef hash_map <const binding_key *, const svalue *> map_t;
   typedef map_t::iterator iterator_t;
 
-  binding_cluster (const region *base_region)
-  : m_base_region (base_region), m_map (),
-    m_escaped (false), m_touched (false) {}
+  binding_cluster (const region *base_region);
   binding_cluster (const binding_cluster &other);
   binding_cluster& operator=(const binding_cluster &other);


                 reply	other threads:[~2022-07-20  0:23 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=20220720002340.A534E3858D37@sourceware.org \
    --to=dmalcolm@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: link
Be 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).