From patchwork Fri Nov 7 00:59:22 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 407936 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 92CA814008C for ; Fri, 7 Nov 2014 12:23:35 +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:in-reply-to:references; q=dns; s= default; b=awrScK9LXavdgdxZ+ozHVscla2GZ92+2jduSRswZQkk9FbpWN3tba t2rolIpfHFOetxPtMXOCNmu0VFJHkxGOysh5LUsDdNpuNWAbu5C7iSi/Hy2KYEBC YcwK8TolbvGF5IBKeN7YA8ds/KCLUAdTeSx5HEyRWKTzrXHc5Rsz7o= 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:in-reply-to:references; s= default; bh=9IHQ4nRzt3wrnBfw8/Twm1xkqUg=; b=NCftC19FYrp2HVS/t1rH JLXBu2mK4ZoFNgzGpVmooHs8We0ix7dDMQhlxJcQ00yEEWRwYOjTumIyDp/w/mWE U9z9uBtB+EpkdMpaiBM7IwPVArsPeK2mC1YoUVkDT9mEFNF4t8FrNk6CS5e+VOF1 o5Srx5IGkO9AJ8cYRhew4tc= Received: (qmail 3767 invoked by alias); 7 Nov 2014 01:23: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 3737 invoked by uid 89); 7 Nov 2014 01:23:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (208.118.235.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 07 Nov 2014 01:23:23 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmXy0-0004zM-UX for gcc-patches@gcc.gnu.org; Thu, 06 Nov 2014 20:04:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmXy0-0004yv-NC for gcc-patches@gcc.gnu.org; Thu, 06 Nov 2014 20:03:56 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA713tVm003591 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 6 Nov 2014 20:03:56 -0500 Received: from surprise.redhat.com (vpn-235-14.phx2.redhat.com [10.3.235.14]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA713ouQ008548; Thu, 6 Nov 2014 20:03:55 -0500 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [gimple-classes, committed 08/17] tree-sra.c: Use gassign Date: Thu, 6 Nov 2014 19:59:22 -0500 Message-Id: <1415321971-19808-9-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1415321971-19808-1-git-send-email-dmalcolm@redhat.com> References: <1415321971-19808-1-git-send-email-dmalcolm@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 X-IsSubscribed: yes gcc/ChangeLog.gimple-classes: * tree-sra.c (build_accesses_from_assign): Strengthen param "stmt" from gimple to gassign *. (scan_function): Add checked cast within case GIMPLE_ASSIGN. (sra_modify_constructor_assign): Strengthen param "stmt" from gimple to gassign *. (sra_modify_assign): Likewise. (sra_modify_function_body): Add checked cast within case GIMPLE_ASSIGN. (ptr_parm_has_direct_uses): Introduce local "assign_stmt" from result of gimple_assign_single_p, using it in place of "stmt" for typesafety. (replace_removed_params_ssa_names): Add checked casts. (sra_ipa_modify_assign): Strengthen param "stmt" from gimple to gassign *. (ipa_sra_modify_function_body): Add checked cast within case GIMPLE_ASSIGN. --- gcc/ChangeLog.gimple-classes | 19 +++++++++++++++++++ gcc/tree-sra.c | 24 +++++++++++++----------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index f799570..4e563ee 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,5 +1,24 @@ 2014-11-06 David Malcolm + * tree-sra.c (build_accesses_from_assign): Strengthen param "stmt" + from gimple to gassign *. + (scan_function): Add checked cast within case GIMPLE_ASSIGN. + (sra_modify_constructor_assign): Strengthen param "stmt" from + gimple to gassign *. + (sra_modify_assign): Likewise. + (sra_modify_function_body): Add checked cast within case + GIMPLE_ASSIGN. + (ptr_parm_has_direct_uses): Introduce local "assign_stmt" from + result of gimple_assign_single_p, using it in place of "stmt" for + typesafety. + (replace_removed_params_ssa_names): Add checked casts. + (sra_ipa_modify_assign): Strengthen param "stmt" from gimple to + gassign *. + (ipa_sra_modify_function_body): Add checked cast within case + GIMPLE_ASSIGN. + +2014-11-06 David Malcolm + * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Strengthen param "stmt" from gimple to gassign *. (follow_ssa_edge): Add checked cast within case GIMPLE_ASSIGN. diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 85a9a87..1cb1ef1 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1178,7 +1178,7 @@ disqualify_if_bad_bb_terminating_stmt (gimple stmt, tree lhs, tree rhs) true if any access has been inserted. */ static bool -build_accesses_from_assign (gimple stmt) +build_accesses_from_assign (gassign *stmt) { tree lhs, rhs; struct access *lacc, *racc; @@ -1298,7 +1298,7 @@ scan_function (void) break; case GIMPLE_ASSIGN: - ret |= build_accesses_from_assign (stmt); + ret |= build_accesses_from_assign (as_a (stmt)); break; case GIMPLE_CALL: @@ -3034,7 +3034,7 @@ enum assignment_mod_result { SRA_AM_NONE, /* nothing done for the stmt */ the same values as sra_modify_assign. */ static enum assignment_mod_result -sra_modify_constructor_assign (gimple stmt, gimple_stmt_iterator *gsi) +sra_modify_constructor_assign (gassign *stmt, gimple_stmt_iterator *gsi) { tree lhs = gimple_assign_lhs (stmt); struct access *acc; @@ -3124,7 +3124,7 @@ contains_vce_or_bfcref_p (const_tree ref) copying. */ static enum assignment_mod_result -sra_modify_assign (gimple stmt, gimple_stmt_iterator *gsi) +sra_modify_assign (gassign *stmt, gimple_stmt_iterator *gsi) { struct access *lacc, *racc; tree lhs, rhs; @@ -3405,7 +3405,8 @@ sra_modify_function_body (void) break; case GIMPLE_ASSIGN: - assign_result = sra_modify_assign (stmt, &gsi); + assign_result = sra_modify_assign (as_a (stmt), + &gsi); modified |= assign_result == SRA_AM_MODIFIED; deleted = assign_result == SRA_AM_REMOVED; break; @@ -3681,9 +3682,9 @@ ptr_parm_has_direct_uses (tree parm) && !TREE_THIS_VOLATILE (lhs)) uses_ok++; } - if (gimple_assign_single_p (stmt)) + if (gassign *assign_stmt = gimple_assign_single_p (stmt)) { - tree rhs = gimple_assign_rhs1 (stmt); + tree rhs = gimple_assign_rhs1 (assign_stmt); while (handled_component_p (rhs)) rhs = TREE_OPERAND (rhs, 0); if (TREE_CODE (rhs) == MEM_REF @@ -4531,7 +4532,7 @@ replace_removed_params_ssa_names (gimple stmt, if (gimple_code (stmt) == GIMPLE_PHI) lhs = gimple_phi_result (stmt); else if (is_gimple_assign (stmt)) - lhs = gimple_assign_lhs (stmt); + lhs = gimple_assign_lhs (as_a (stmt)); else if (is_gimple_call (stmt)) lhs = gimple_call_lhs (stmt); else @@ -4562,7 +4563,7 @@ replace_removed_params_ssa_names (gimple stmt, } if (is_gimple_assign (stmt)) - gimple_assign_set_lhs (stmt, name); + gimple_assign_set_lhs (as_a (stmt), name); else if (is_gimple_call (stmt)) gimple_call_set_lhs (stmt, name); else @@ -4579,7 +4580,7 @@ replace_removed_params_ssa_names (gimple stmt, point to the statement). Return true iff the statement was modified. */ static bool -sra_ipa_modify_assign (gimple stmt, gimple_stmt_iterator *gsi, +sra_ipa_modify_assign (gassign *stmt, gimple_stmt_iterator *gsi, ipa_parm_adjustment_vec adjustments) { tree *lhs_p, *rhs_p; @@ -4668,7 +4669,8 @@ ipa_sra_modify_function_body (ipa_parm_adjustment_vec adjustments) break; case GIMPLE_ASSIGN: - modified |= sra_ipa_modify_assign (stmt, &gsi, adjustments); + modified |= sra_ipa_modify_assign (as_a (stmt), + &gsi, adjustments); modified |= replace_removed_params_ssa_names (stmt, adjustments); break;