From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 591EA384AB52; Thu, 9 May 2024 17:10:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 591EA384AB52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715274655; bh=wbxit/P0P4rcFpX9JvuWn3PFNSzOf5IBNPBbXEr5sdU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=E4ui8eBnXlyeDuCIENtombyaA5RnswM7SNK2VlTBqHSoY6fyaXBKR0P3Yf7jJDZh3 vwZkrhTo89vPyxLCbi0oOl4mWQxFi1erkpgCPSd+rNv/BJUvOfOIiyEcynujNxYXPn RDWHflwu87n51kB4NZdI1chATZfSWmsbT2tbGqDU= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/110112] [11/12/13 Regression] gcc -fanalyzer takes an excessive amount of time Date: Thu, 09 May 2024 17:10:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: compile-time-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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=3D110112 --- Comment #6 from GCC Commits --- The releases/gcc-13 branch has been updated by David Malcolm : https://gcc.gnu.org/g:89feb3557a018893cfe50c2e07f91559bd3cde2b commit r13-8741-g89feb3557a018893cfe50c2e07f91559bd3cde2b Author: David Malcolm Date: Thu May 9 13:09:26 2024 -0400 analyzer: add caching to globals with initializers [PR110112] PR analyzer/110112 notes that -fanalyzer is extremely slow on a source file with large read-only static arrays, repeatedly building the same compound_svalue representing the full initializer, and repeatedly building svalues representing parts of the the full initialiazer. This patch adds caches for both of these; together they reduce the time taken by -fanalyzer -O2 on the testcase in the bug for an optimized build: 91.2s : no caches (status quo) 32.4s : cache in decl_region::get_svalue_for_constructor 3.7s : cache in region::get_initial_value_at_main 3.1s : both caches (this patch) gcc/analyzer/ChangeLog: PR analyzer/110112 * region-model.cc (region_model::get_initial_value_for_global): Move code to region::calc_initial_value_at_main. * region.cc (region::get_initial_value_at_main): New function. (region::calc_initial_value_at_main): New function, based on co= de in region_model::get_initial_value_for_global. (region::region): Initialize m_cached_init_sval_at_main. (decl_region::get_svalue_for_constructor): Add a cache, splitti= ng out body to... (decl_region::calc_svalue_for_constructor): ...this new functio= n. * region.h (region::get_initial_value_at_main): New decl. (region::calc_initial_value_at_main): New decl. (region::m_cached_init_sval_at_main): New field. (decl_region::decl_region): Initialize m_ctor_svalue. (decl_region::calc_svalue_for_constructor): New decl. (decl_region::m_ctor_svalue): New field. (cherry picked from commit r14-1664-gfe9771b59f576f) Signed-off-by: David Malcolm =