From patchwork Wed Jun 27 07:54:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 935339 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-480533-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="FOWsusCv"; 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 41FwDp5lY3z9s0n for ; Wed, 27 Jun 2018 17:55:06 +1000 (AEST) 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=GJyG8ytpl8txirxu g38qjLM1c2C9cR1FrPZYWKAyRXnqOkbKrXEKtDeZEUYxaMDtNkiHvICP2NJgJ0QT /m88u6jSQPvbIoW5QrB6BL4o/IKCyr1e4Dnklk1TxoS3gPLqwrTg2kkKYkF60F8M O54lkLK96ns6QZhcwKeNwZCBdqI= 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=TLi8On2YPUMSbgjOsqIJYZ Wmn20=; b=FOWsusCvbazeVlQSm9gxHhTKwuXThNVk1lUk1DAqCrkyHELCMMEryX oA6W8rcwTmesJm1S75Md+RhZy8vwjKS2z8lPM63b/jh4/BdzsaTm7wtZKBHZIHaA QQKXCO7wYmSkYU/bhQqbwTkkReAxpbuROpkrQWnHPdMbKxSJAOeQs= Received: (qmail 94769 invoked by alias); 27 Jun 2018 07:54:59 -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 94262 invoked by uid 89); 27 Jun 2018 07:54:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=recognizing, tweaked 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; Wed, 27 Jun 2018 07:54:56 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 43C90818CC for ; Wed, 27 Jun 2018 09:54:54 +0200 (CEST) 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 GDv1HrqnsGVh for ; Wed, 27 Jun 2018 09:54:54 +0200 (CEST) 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 10E3181A10 for ; Wed, 27 Jun 2018 09:54:53 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Remove left-overs from BND support Date: Wed, 27 Jun 2018 09:54:50 +0200 Message-ID: <5279151.M1UyTDLhbo@polaris> MIME-Version: 1.0 Tested on x86-64/Linux, OK for the mainline? 2018-06-27 Eric Botcazou * gimple.h (gimple_return_retbnd): Delete. (gimple_return_set_retbnd): Likewise. * cgraphunit.c (cgraph_node::expand_thunk): Remove call to gimple_return_set_retbnd. * gimple-pretty-print.c (dump_gimple_return): Remove call to gimple_return_retbnd and adjust. * tree-inline.h (struct copy_body_data): Remove retbnd field. * tree-inline.c (remap_gimple_stmt): Remove handling of retbnd. Explicitly return NULL in a couple more cases. Move assertion on debug statements and remove unreachable code. (reset_debug_binding): Do not test id->retbnd. (expand_call_inline): Do not set it. Index: cgraphunit.c =================================================================== --- cgraphunit.c (revision 262165) +++ cgraphunit.c (working copy) @@ -1803,7 +1803,6 @@ cgraph_node::expand_thunk (bool output_a int i; tree resdecl; tree restmp = NULL; - tree resbnd = NULL; gcall *call; greturn *ret; @@ -1994,7 +1993,6 @@ cgraph_node::expand_thunk (bool output_a ret = gimple_build_return (restmp); else ret = gimple_build_return (resdecl); - gimple_return_set_retbnd (ret, resbnd); gsi_insert_after (&bsi, ret, GSI_NEW_STMT); } Index: gimple.h =================================================================== --- gimple.h (revision 262165) +++ gimple.h (working copy) @@ -6198,26 +6198,6 @@ gimple_return_set_retval (greturn *gs, t } -/* Return the return bounds for GIMPLE_RETURN GS. */ - -static inline tree -gimple_return_retbnd (const gimple *gs) -{ - GIMPLE_CHECK (gs, GIMPLE_RETURN); - return gimple_op (gs, 1); -} - - -/* Set RETVAL to be the return bounds for GIMPLE_RETURN GS. */ - -static inline void -gimple_return_set_retbnd (gimple *gs, tree retval) -{ - GIMPLE_CHECK (gs, GIMPLE_RETURN); - gimple_set_op (gs, 1, retval); -} - - /* Returns true when the gimple statement STMT is any of the OMP types. */ #define CASE_GIMPLE_OMP \ Index: gimple-pretty-print.c =================================================================== --- gimple-pretty-print.c (revision 262165) +++ gimple-pretty-print.c (working copy) @@ -645,12 +645,11 @@ static void dump_gimple_return (pretty_printer *buffer, greturn *gs, int spc, dump_flags_t flags) { - tree t, t2; + tree t; t = gimple_return_retval (gs); - t2 = gimple_return_retbnd (gs); if (flags & TDF_RAW) - dump_gimple_fmt (buffer, spc, flags, "%G <%T %T>", gs, t, t2); + dump_gimple_fmt (buffer, spc, flags, "%G <%T>", gs, t); else { pp_string (buffer, "return"); @@ -659,11 +658,6 @@ dump_gimple_return (pretty_printer *buff pp_space (buffer); dump_generic_node (buffer, t, spc, flags, false); } - if (t2) - { - pp_string (buffer, ", "); - dump_generic_node (buffer, t2, spc, flags, false); - } pp_semicolon (buffer); } } Index: tree-inline.c =================================================================== --- tree-inline.c (revision 262165) +++ tree-inline.c (working copy) @@ -1382,35 +1382,24 @@ remap_gimple_stmt (gimple *stmt, copy_bo && (gimple_debug_nonbind_marker_p (stmt) ? !DECL_STRUCT_FUNCTION (id->dst_fn)->debug_nonbind_markers : !opt_for_fn (id->dst_fn, flag_var_tracking_assignments))) - return stmts; + return NULL; /* Begin by recognizing trees that we'll completely rewrite for the inlining context. Our output for these trees is completely - different from out input (e.g. RETURN_EXPR is deleted, and morphs + different from our input (e.g. RETURN_EXPR is deleted and morphs into an edge). Further down, we'll handle trees that get duplicated and/or tweaked. */ - /* When requested, GIMPLE_RETURNs should be transformed to just the + /* When requested, GIMPLE_RETURN should be transformed to just the contained GIMPLE_ASSIGN. The branch semantics of the return will be handled elsewhere by manipulating the CFG rather than the statement. */ if (gimple_code (stmt) == GIMPLE_RETURN && id->transform_return_to_modify) { tree retval = gimple_return_retval (as_a (stmt)); - tree retbnd = gimple_return_retbnd (stmt); - tree bndslot = id->retbnd; - - if (retbnd && bndslot) - { - gimple *bndcopy = gimple_build_assign (bndslot, retbnd); - memset (&wi, 0, sizeof (wi)); - wi.info = id; - walk_gimple_op (bndcopy, remap_gimple_op_r, &wi); - gimple_seq_add_stmt (&stmts, bndcopy); - } /* If we're returning something, just turn that into an - assignment into the equivalent of the original RESULT_DECL. + assignment to the equivalent of the original RESULT_DECL. If RETVAL is just the result decl, the result decl has already been set (e.g. a recent "foo (&result_decl, ...)"); just toss the entire GIMPLE_RETURN. */ @@ -1427,7 +1416,7 @@ remap_gimple_stmt (gimple *stmt, copy_bo skip_first = true; } else - return stmts; + return NULL; } else if (gimple_has_substatements (stmt)) { @@ -1668,7 +1657,6 @@ remap_gimple_stmt (gimple *stmt, copy_bo gimple_seq_add_stmt (&stmts, copy); return stmts; } - gcc_checking_assert (!is_gimple_debug (stmt)); /* Create a new deep copy of the statement. */ copy = gimple_copy (stmt); @@ -1754,8 +1742,7 @@ remap_gimple_stmt (gimple *stmt, copy_bo } } - /* If STMT has a block defined, map it to the newly constructed - block. */ + /* If STMT has a block defined, map it to the newly constructed block. */ if (gimple_block (copy)) { tree *n; @@ -1764,12 +1751,8 @@ remap_gimple_stmt (gimple *stmt, copy_bo gimple_set_block (copy, *n); } - if (gimple_debug_bind_p (copy) || gimple_debug_source_bind_p (copy) - || gimple_debug_nonbind_marker_p (copy)) - { - gimple_seq_add_stmt (&stmts, copy); - return stmts; - } + /* Debug statements ought to be rebuilt and not copied. */ + gcc_checking_assert (!is_gimple_debug (copy)); /* Remap all the operands in COPY. */ memset (&wi, 0, sizeof (wi)); @@ -4274,7 +4257,7 @@ reset_debug_binding (copy_body_data *id, if (!VAR_P (*remappedvarp)) return; - if (*remappedvarp == id->retvar || *remappedvarp == id->retbnd) + if (*remappedvarp == id->retvar) return; tree tvar = target_for_debug_bind (*remappedvarp); @@ -4834,7 +4817,6 @@ expand_call_inline (basic_block bb, gimp id->block = NULL_TREE; id->retvar = NULL_TREE; - id->retbnd = NULL_TREE; successfully_inlined = true; egress: Index: tree-inline.h =================================================================== --- tree-inline.h (revision 262165) +++ tree-inline.h (working copy) @@ -63,9 +63,6 @@ struct copy_body_data /* The VAR_DECL for the return value. */ tree retvar; - /* The VAR_DECL for the return bounds. */ - tree retbnd; - /* Assign statements that need bounds copy. */ vec assign_stmts;