From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B20CD3858D33; Tue, 7 Feb 2023 13:31:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B20CD3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675776682; bh=8sAieG4TXpGOaBH6pV+sZfhS1aAQS86iX2TWLZJHB0o=; h=From:To:Subject:Date:From; b=rkcqIXdinm1fi0X+tgYlCr5uEb3uBqAZXhP6nC3k33tIYaLk/g4OK9k5pANzrfaKB O+JIzq/SSyxJchhv+5i2pD+McLausTCJgPbsgJ0riHyIUMCEW115Iz9PnxRW1UAttU PPCCxP3hpIin/Nwal26Mk+jjDUsXwpKW/DHPtptM= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108697] New: constructing a path-range-query is expensive Date: Tue, 07 Feb 2023 13:31:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108697 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 =3D SSA_NAME_VERSION (name); if (v >=3D 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.=