From patchwork Thu Nov 6 14:31:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 407537 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 6C1801400AB for ; Fri, 7 Nov 2014 01:40: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=PuyMAakdhos0RtBCrVaWtS87grV7ISsh2qQ0szMgVK0l7dLOxY51g Im+MbI6mHYIaYIj0yCk/bpFDn4PCBH7eoDdWXvD0lSdttWazPrlwl+KZnUZKvY7R UM/PHv1YTp5KoYqbVG+WuIWohkWr4SkPjtQiC23/+R0N5ux49F5NCo= 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=7yWJKTncWmhgsY9kRKXpngWgWM0=; b=j+OZ5UPvjEmkv21apJbb dpcbW+q+/E1hFRuHcr+5/WDN5u4jAJXKCdV7R+/s222CqfVnuqE9zqFrwoATkdDX c9ygnj+fybMb0EITKUwP47Cz1PSMd5i90nzabt5WkH4XS6mhqP9EJlm48H8mzLxO GTW9peSfzqOm2ubo4/c+gJg= Received: (qmail 25439 invoked by alias); 6 Nov 2014 14:37:04 -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 25321 invoked by uid 89); 6 Nov 2014 14:37:03 -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; Thu, 06 Nov 2014 14:37:00 +0000 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmOB9-0006kk-3y for gcc-patches@gcc.gnu.org; Thu, 06 Nov 2014 09:36:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmOB8-0006kb-Ri for gcc-patches@gcc.gnu.org; Thu, 06 Nov 2014 09:36:51 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA6Eanip027889 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 6 Nov 2014 09:36:50 -0500 Received: from surprise.redhat.com (vpn-235-14.phx2.redhat.com [10.3.235.14]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA6Eag7l016497; Thu, 6 Nov 2014 09:36:48 -0500 From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [gimple-classes, committed 09/44] auto-profile.c: Use gassign Date: Thu, 6 Nov 2014 09:31:45 -0500 Message-Id: <1415284340-14186-10-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1415284340-14186-1-git-send-email-dmalcolm@redhat.com> References: <1415284340-14186-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: * auto-profile.c (afdo_propagate_circuit): Replace a check for GIMPLE_ASSIGN within the while loop with a dyn_cast, introducing a local "def_assign", using it in place of "stmt" for typesafety. This involves replacing the series of while conditions in the head of the while into a list of conditionals within its body that break out of the loop, thus requiring the conditions to be negated. --- gcc/ChangeLog.gimple-classes | 10 ++++++++++ gcc/auto-profile.c | 15 +++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes index 5902705..e8d2d6e 100644 --- a/gcc/ChangeLog.gimple-classes +++ b/gcc/ChangeLog.gimple-classes @@ -1,3 +1,13 @@ +2014-11-03 David Malcolm + + * auto-profile.c (afdo_propagate_circuit): Replace a check for + GIMPLE_ASSIGN within the while loop with a dyn_cast, introducing + a local "def_assign", using it in place of "stmt" for typesafety. + This involves replacing the series of while conditions in the head + of the while into a list of conditionals within its body that + break out of the loop, thus requiring the conditions to be + negated. + 2014-10-31 David Malcolm * tree-ssa-forwprop.c (get_prop_source_stmt): Strengthen return diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c index ba4e567..320b2f6 100644 --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -1262,10 +1262,17 @@ afdo_propagate_circuit (const bb_set &annotated_bb, edge_set *annotated_edge) if (!is_bb_annotated (bb, annotated_bb)) continue; def_stmt = SSA_NAME_DEF_STMT (cmp_lhs); - while (def_stmt && gimple_code (def_stmt) == GIMPLE_ASSIGN - && gimple_assign_single_p (def_stmt) - && TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME) - def_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_stmt)); + while (def_stmt) + { + gassign *def_assign = dyn_cast (def_stmt); + if (!def_assign) + break; + if (!gimple_assign_single_p (def_assign)) + break; + if (TREE_CODE (gimple_assign_rhs1 (def_assign)) != SSA_NAME) + break; + def_stmt = SSA_NAME_DEF_STMT (gimple_assign_rhs1 (def_assign)); + } if (!def_stmt) continue; gphi *phi_stmt = dyn_cast (def_stmt);