From patchwork Thu Dec 14 17:13:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 848677 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-469224-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="MIKUd/YD"; 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 3yyKry32GHz9sCZ for ; Fri, 15 Dec 2017 04:13:21 +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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=diYwbFrcHTq4Px4I mW/Yawnleq9XgcZum++XjlK4+Zuy0EGzdU6m7mb6BUs8lWbpS1WKbO7VbksbRsX5 d1Mk/7Hs8yCdw9wnMO8UVcmteUSOunJUv2Rr+9pay7069GG0TN7kQBrrvAI9Y9q8 wV4tgctGj4hnC2zg3AxnE0+LmK4= 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=TDOZrOjMrZNRWIy+bM7RtQ jBLjY=; b=MIKUd/YDuKcowGIN4NFKzboT8vhlbRGx9O5GVFUHwLCn2qFvBJXqzA 0sirSEyPYbA/7XILJofPHgofAFTY9gJ1Q7YaZWhcmj0kwabanrIPK7jd3JNV/oyy oE393/OCaCAEPUyEn63iHox5dcj5/LiKK2dmA0yeRLLS9V8TNTymc= Received: (qmail 25906 invoked by alias); 14 Dec 2017 17:13:13 -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 25897 invoked by uid 89); 14 Dec 2017 17:13:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Dec 2017 17:13:11 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 978BF813A0 for ; Thu, 14 Dec 2017 18:13:09 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ocL93Y0V0Ylj for ; Thu, 14 Dec 2017 18:13:09 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 73A7581393 for ; Thu, 14 Dec 2017 18:13:09 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix compilation time explosion due to recursive inlining Date: Thu, 14 Dec 2017 18:13:08 +0100 Message-ID: <1588446.7ZH8RZGjbo@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 This clears DECL_DISREGARD_INLINE_LIMITS on recursive expression functions. Tested on x86_64-suse-linux, applied on the mainline. 2017-12-14 Eric Botcazou * gcc-interface/trans.c (Call_to): Set DECL_DISREGARD_INLINE_LIMITS to 0 on the callee if the call is recursive. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 255631) +++ gcc-interface/trans.c (working copy) @@ -4306,10 +4306,16 @@ Call_to_gnu (Node_Id gnat_node, tree *gn return call_expr; } - /* For a call to a nested function, check the inlining status. */ - if (TREE_CODE (gnu_subprog) == FUNCTION_DECL - && decl_function_context (gnu_subprog)) - check_inlining_for_nested_subprog (gnu_subprog); + if (TREE_CODE (gnu_subprog) == FUNCTION_DECL) + { + /* For a call to a nested function, check the inlining status. */ + if (decl_function_context (gnu_subprog)) + check_inlining_for_nested_subprog (gnu_subprog); + + /* For a recursive call, avoid explosion due to recursive inlining. */ + if (gnu_subprog == current_function_decl) + DECL_DISREGARD_INLINE_LIMITS (gnu_subprog) = 0; + } /* The only way we can be making a call via an access type is if Name is an explicit dereference. In that case, get the list of formal args from the