public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108697] New: constructing a path-range-query is expensive
@ 2023-02-07 13:31 rguenth at gcc dot gnu.org
  2023-02-07 14:13 ` [Bug tree-optimization/108697] " aldyh at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-07 13:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108697

            Bug ID: 108697
           Summary: constructing a path-range-query is expensive
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

Looking at the profile of the compiler.i testcase from PR26854 one can see
ssa_global_cache::set_global_range very high in the profile, specifically
the clearing of m_tab:

bool
ssa_global_cache::set_global_range (tree name, const vrange &r)
{
  unsigned v = SSA_NAME_VERSION (name);
  if (v >= m_tab.length ())
    m_tab.safe_grow_cleared (num_ssa_names + 1);

note this cache is allocated freshly each time a path_range_query is
allocated which makes this process (in case any global range is registered)
O(num-ssa-names) which for large functions can be very expensive.

None of the path_range_query CTORs supports sharing the cache (and I'm not
sure that would be "correct").  For the testcase at hand nearly all
ssa_global_cache objects are allocated from path_range_query and the
backwards threader.  But there are CTOR calls from the ranger_cache CTOR
as well - the backwards threader also has a ranger instance, so I wonder
if one can take the global cache from that (co-incidentially the path-range
query instance gets a reference to a ranger instance ...).

Maybe ssa_global_cache is just a very bad representation for the path
range query.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-10-11 19:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 13:31 [Bug tree-optimization/108697] New: constructing a path-range-query is expensive rguenth at gcc dot gnu.org
2023-02-07 14:13 ` [Bug tree-optimization/108697] " aldyh at gcc dot gnu.org
2023-02-07 14:31 ` rguenth at gcc dot gnu.org
2023-02-07 14:34 ` rguenth at gcc dot gnu.org
2023-02-07 15:03 ` aldyh at gcc dot gnu.org
2023-02-07 19:52 ` aldyh at gcc dot gnu.org
2023-02-10  2:54 ` amacleod at redhat dot com
2023-04-26 19:26 ` cvs-commit at gcc dot gnu.org
2023-10-11 19:51 ` amacleod at redhat dot com

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