From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 15E5F3846402; Wed, 3 Apr 2024 06:57:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 15E5F3846402 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712127431; bh=AoBLN9IHcB768+tVUihAsuqjwThuNm10fsmcfZ6rthM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=le8mLUcuyz5ak3Ur2f/hv1Qwn4K9LQ/S/9V1mw3mNwRhzQ4YZeVjQ6t6FB/lCbwP6 hoSHL9L9A1X06oH15ia2kOBh4qhEufBcqfnh+OE5YzJU6+5lENOy2BkWmmrTtxJ9bZ gSmkoPjqCvPO/yojhHvz8IHEgQBeStXAc3qAmj+4= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/114557] ehcleanup cleanup_empty_eh_merge_phis eats a lot of memory Date: Wed, 03 Apr 2024 06:57:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: compile-time-hog, memory-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW 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: 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=3D114557 --- Comment #3 from GCC Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:e7b7188b1cf8c174f0e890d4ac279ff480b51043 commit r14-9767-ge7b7188b1cf8c174f0e890d4ac279ff480b51043 Author: Richard Biener Date: Tue Apr 2 12:31:04 2024 +0200 tree-optimization/114557 - reduce ehcleanup peak memory use The following reduces peak memory use for the PR114480 testcase at -O1 which is almost exclusively spent by the ehcleanup pass in allocating PHI nodes. The free_phinodes cache we maintain isn't very effective since it has effectively two slots, one for 4 and one for 9 argument PHIs and it is only ever used for allocations up to 9 arguments but we put all larger PHIs in the 9 argument bucket. This proves uneffective resulting in much garbage to be kept when incrementally growing PHI nodes by edge redirection. The mitigation is to rely on the GC freelist for larger sizes and thus immediately return all larger bucket sized PHIs to it via ggc_free. This reduces the peak memory use from 19.8GB to 11.3GB and compile-time from 359s to 168s. PR tree-optimization/114557 PR tree-optimization/114480 * tree-phinodes.cc (release_phi_node): Return PHIs from allocation buckets not covered by free_phinodes to GC. (remove_phi_node): Release the PHI LHS before freeing the PHI node. * tree-vect-loop.cc (vectorizable_live_operation): Get PHI lhs before releasing it.=