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>
This commit is contained in:
David Malcolm 2022-07-19 20:22:18 -04:00
parent 7c0c10db24
commit 68871a008e
3 changed files with 12 additions and 3 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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);