From patchwork Mon Jan 20 01:38:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 1225591 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-517703-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=mMdOk+0N; dkim=pass (2048-bit key; unprotected) header.d=marvell.com header.i=@marvell.com header.a=rsa-sha256 header.s=pfpt0818 header.b=EEIIQBR7; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 481DqR3d0tz9sP6 for ; Mon, 20 Jan 2020 12:39:28 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; q=dns; s=default; b=Nxq8OJ/l/CaUjGC1v+MDiMY7IkWOFRC6/T51bR5XaGk5ufb0k0 wluKyoOWf1McxAVGPk9kwd8cBSxl4l4XS5QrU2k/ZvEIL9IMeF8alze5KVB6+QRp nxvCyaJ48mt5lIT+kmRbKAAT+wIpGixiNf/vWsr3XZIX9oHE7Y5KpMryg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:mime-version:content-type; s= default; bh=ej+UuuBUU0ecYjfonIhlT5OqD38=; b=mMdOk+0Nr/WGXit835gp seMNTTmJ7xEEHXvW4gBRHOjwAy7rR0YSJqf1vBBUEyQ/L6jtD/fbN8Z+mYor+Kzr 2JRZ1IQhfP7He6rRHngDBLXt1XRez1wJj8+G8duRAYRKOZheoDeZScnrCHSPBcWp 1rWZn1oTAHK0lhJzchRsqWM= Received: (qmail 2332 invoked by alias); 20 Jan 2020 01:39:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 2320 invoked by uid 89); 20 Jan 2020 01:39:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-27.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.1 spammy=dominated, son, visit X-HELO: mx0b-0016f401.pphosted.com Received: from mx0b-0016f401.pphosted.com (HELO mx0b-0016f401.pphosted.com) (67.231.156.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Jan 2020 01:39:16 +0000 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00K1ZDBR024225 for ; Sun, 19 Jan 2020 17:39:14 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0818; bh=qtMGnpPvEwnY/a78ZdgIFEkUimAtCxCsEmbMf0oPzvg=; b=EEIIQBR7Ed7z8/D5y3+PEtsJsuCcQK6zmZzhSkqrvNBNNwAIhOlWqwXBFtI8IzqLn8cK ZlkTGB6enObS/Gju4jpmgcHRusyA01CSgbmDeyatUHsD7/wXRh6/1V+HVtqMBILbTDRz m8xlBRfRd/yaCR11pvE4n6oVzaUaLyGZohWGHQXarkowak5jaUMUsi3Sd1vE8OENdkeq ZqgAgpCwhRjqJrMllewGDKW8dxentlDrlU3bfncB2uAeOqSIh90rnKl0nW5S9DA9wVSW emvzDjqCvyNVc18K1It4F7EZRMH3iSDJwUaAoaxsBVrRYnpsvGH614dgH+KVMQ/HBsq5 AQ== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2xm2dsv9re-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sun, 19 Jan 2020 17:39:13 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 19 Jan 2020 17:39:12 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 19 Jan 2020 17:39:12 -0800 Received: from linux.pinskiwright.org.com (unknown [10.104.47.220]) by maili.marvell.com (Postfix) with ESMTP id 897133F703F; Sun, 19 Jan 2020 17:39:06 -0800 (PST) From: To: CC: Andrew Pinski Subject: [PATCH] Manually handle recursiveness in prepare_block_for_update Date: Sun, 19 Jan 2020 17:38:41 -0800 Message-ID: <1579484321-580-1-git-send-email-apinski@marvell.com> MIME-Version: 1.0 From: Andrew Pinski Reported as PR 93321, prepare_block_for_update with some huge recusive inlining can go past the stack limit. The loop at the end, could be transformed such that the last iteration goes back to the begining of the function instead of the call. This reduces the stack usage and speeds up slightly the function. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. ChangeLog: * tree-into-ssa.c (prepare_block_for_update): Manaually sibcall optimize to self. --- gcc/tree-into-ssa.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index c27bf2ce121..6e139c3b056 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -2616,6 +2616,7 @@ prepare_block_for_update (basic_block bb, bool insert_phi_p) edge e; edge_iterator ei; +again: mark_block_for_update (bb); /* Process PHI nodes marking interesting those that define or use @@ -2695,10 +2696,17 @@ prepare_block_for_update (basic_block bb, bool insert_phi_p) } /* Now visit all the blocks dominated by BB. */ - for (son = first_dom_son (CDI_DOMINATORS, bb); - son; - son = next_dom_son (CDI_DOMINATORS, son)) - prepare_block_for_update (son, insert_phi_p); + for (son = first_dom_son (CDI_DOMINATORS, bb); son; ) + { + basic_block next = next_dom_son (CDI_DOMINATORS, son); + if (!next) + { + bb = son; + goto again; + } + prepare_block_for_update (son, insert_phi_p); + son = next; + } }