From patchwork Fri May 12 16:29:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 761723 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3wPb6J3lW2z9s3s for ; Sat, 13 May 2017 02:29:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Eba/FHxO"; dkim-atps=neutral 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:references:in-reply-to :content-type:content-transfer-encoding:mime-version; q=dns; s= default; b=J+0cq+4hMeFw5CsZ+ynyFQ2v6XhUMBAEl4TBCh7HmO99JKgCgYrf1 mjNrzCcX/nr3LDRpCJvbsJXNamGL8KlVnzbzpcQQyzaibXPjXZwlxC9K5Kktt4eo dEayrm55alozeE7bVNyfmPK4WCRkxA+02fKurYF9UKIWvqzp6pTvVk= 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:references:in-reply-to :content-type:content-transfer-encoding:mime-version; s=default; bh=QSKSfuA1JbF50oM4oDU+h6TGJAI=; b=Eba/FHxO7/Xo87Bz9aEzn9xJu5Ua SVY/6/7mIunamOda8B9QWs6owWCjlNzvWLBgeq9goWIgGgTDBYYvfOv8mfs6JQYE Tyh+d5joRT7keaizItxcY8hyuFbrQ+QJnI8sKm3cS5wYO0Do4w3bcJs3Mz/eSy8O /rY3Q4dlsxKdsi8= Received: (qmail 105705 invoked by alias); 12 May 2017 16:29:28 -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 105691 invoked by uid 89); 12 May 2017 16:29:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-HE1-obe.outbound.protection.outlook.com Received: from mail-he1eur01on0080.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) (104.47.0.80) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 May 2017 16:29:25 +0000 Received: from AM5PR0802MB2610.eurprd08.prod.outlook.com (10.175.46.18) by AM5PR0802MB2610.eurprd08.prod.outlook.com (10.175.46.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Fri, 12 May 2017 16:29:25 +0000 Received: from AM5PR0802MB2610.eurprd08.prod.outlook.com ([10.175.46.18]) by AM5PR0802MB2610.eurprd08.prod.outlook.com ([10.175.46.18]) with mapi id 15.01.1084.020; Fri, 12 May 2017 16:29:25 +0000 From: Wilco Dijkstra To: Alexander Monakov CC: GCC Patches , nd , Jeff Law Subject: Re: [PATCH] Add sequence check to leaf_function_p Date: Fri, 12 May 2017 16:29:25 +0000 Message-ID: References: , In-Reply-To: authentication-results: gcc.gnu.org; dkim=none (message not signed) header.d=none; gcc.gnu.org; dmarc=none action=none header.from=arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM5PR0802MB2610; 7:jzLPG7kt+FdZn2uu3FhSj0sUPuNKfVH09ssoFAPyoFLrls8jldBYq0KgdPlf6DOB+lq4qoeFg0KTHjgMsKwYnf0MlaS4XcXC5mOZ6YaJTOd9n1SBPRCJ2KLryr6fOm1v+5Y/iWNJyGT+xevIx76L4/hdmPfYOYp3rIaFDKd10yNdP16f8kHT2uGMeIl9W0AEb7oeoWg8ZjrBoNHrTiQOAqB4fpE5H+1JelSNOcaDxHqLUm/u8pplDIHzKNLQ4RAu4C1RkaEDZ7ijH/61CAKrAOew6fA4nFcaVW5A9GcuxoMlXy+Hq2LfWU6AaKpceyVbhQogPFbYJFAMU6KF7YrISQ== x-ms-office365-filtering-correlation-id: 2f294a43-5626-43dd-c389-08d499540dcf x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075); SRVR:AM5PR0802MB2610; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123562025)(20161123558100)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148); SRVR:AM5PR0802MB2610; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2610; x-forefront-prvs: 0305463112 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39410400002)(39400400002)(39850400002)(39860400002)(39840400002)(39450400003)(24454002)(377424004)(72206003)(3846002)(3660700001)(4326008)(38730400002)(110136004)(3280700002)(122556002)(189998001)(6436002)(99286003)(53936002)(54906002)(2950100002)(55016002)(9686003)(6916009)(6116002)(7696004)(102836003)(77096006)(5660300001)(2906002)(229853002)(86362001)(575784001)(478600001)(6506006)(2900100001)(8676002)(305945005)(8936002)(33656002)(25786009)(74316002)(7736002)(50986999)(54356999)(76176999)(81166006)(66066001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2610; H:AM5PR0802MB2610.eurprd08.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 May 2017 16:29:25.1642 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2610 Alexander Monakov wrote: > As I understand, we need to ensure that get_insns call retrieves the topmost > sequence corresponding to the function body, not any current subsequence that > could have been started via start_sequence.  Therefore the 'prolog or epilog' > part is a bit misleading, we could be in a subsequence for other reasons, and > we need to reject those as well.  So, ... It's most likely that if this assert triggers, it is from a prolog or epilog sequence. > ... can the comment please be reworded to match the code, if it's necessary to > have a comment here at all?  E.g. "Ensure we walk the entire function body after > the following get_insns call". I've changed to to "Ensure we walk the entire function body." Wilco 2017-05-11 Wilco Dijkstra * final.c (leaf_function_p): Check we are not in a sequence. diff --git a/gcc/final.c b/gcc/final.c index 820162b2d28d734901375017cf0c7a3095e8903e..e61b78b0a915df748fcf3d73cd46db855cf7a1c6 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -4309,6 +4309,9 @@ leaf_function_p (void) { rtx_insn *insn; + /* Ensure we walk the entire function body. */ + gcc_assert (!in_sequence_p ()); + /* Some back-ends (e.g. s390) want leaf functions to stay leaf functions even if they call mcount. */ if (crtl->profile && !targetm.keep_leaf_when_profiled ())