From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 913E93864877; Mon, 19 Feb 2024 13:42:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 913E93864877 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708350150; bh=RPY1OhldEVODFHFWZIzQym8xgChvUJtyhiba0DtDy90=; h=From:To:Subject:Date:From; b=P9XHWWQjX8dC3Y3JYIxMZBnPlS9VNlgvsNupmafgi8iY/cESCFra6Et247e/Bw7ub B+fRLBQDJFrLZbjOAjFhEMp2rUHQkAQe7bXv257gfHgUNTIxTP8iojkhLcsO+ZRm0Q 3wUBEFcTaPQA540E6UBFdYRKJn5vbO4/9ua9qcgc= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-9064] rtl-optimization/54052 - RTL SSA PHI insertion compile-time hog X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/master X-Git-Oldrev: 78b72ee5a80f45bd761a55006e2b3fc2cbe749bc X-Git-Newrev: c7151283dc747769d4ac4f216d8f519bda2569b5 Message-Id: <20240219134230.913E93864877@sourceware.org> Date: Mon, 19 Feb 2024 13:42:30 +0000 (GMT) List-Id: https://gcc.gnu.org/g:c7151283dc747769d4ac4f216d8f519bda2569b5 commit r14-9064-gc7151283dc747769d4ac4f216d8f519bda2569b5 Author: Richard Biener Date: Mon Feb 19 11:10:50 2024 +0100 rtl-optimization/54052 - RTL SSA PHI insertion compile-time hog The following tries to address the PHI insertion compile-time hog in RTL fwprop observed with the PR54052 testcase where the loop computing the "unfiltered" set of variables possibly needing PHI nodes for each block exhibits quadratic compile-time and memory-use. It does so by pruning the local DEFs with LR_OUT of the block, removing regs that can never be LR_IN (defined by this block) in the dominance frontier. PR rtl-optimization/54052 * rtl-ssa/blocks.cc (function_info::place_phis): Filter local defs by LR_OUT. Diff: --- gcc/rtl-ssa/blocks.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/rtl-ssa/blocks.cc b/gcc/rtl-ssa/blocks.cc index 8996443e8d5a..cf4224e61ecf 100644 --- a/gcc/rtl-ssa/blocks.cc +++ b/gcc/rtl-ssa/blocks.cc @@ -645,7 +645,12 @@ function_info::place_phis (build_info &bi) if (bitmap_empty_p (&frontiers[b1])) continue; - bitmap b1_def = &DF_LR_BB_INFO (BASIC_BLOCK_FOR_FN (m_fn, b1))->def; + // Defs in B1 that are possibly in LR_IN in the dominance frontier + // blocks. + auto_bitmap b1_def; + bitmap_and (b1_def, &DF_LR_BB_INFO (BASIC_BLOCK_FOR_FN (m_fn, b1))->def, + DF_LR_OUT (BASIC_BLOCK_FOR_FN (m_fn, b1))); + bitmap_iterator bmi; unsigned int b2; EXECUTE_IF_SET_IN_BITMAP (&frontiers[b1], 0, b2, bmi)