From patchwork Mon Sep 30 18:52:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Teresa Johnson X-Patchwork-Id: 279213 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CC8512C0109 for ; Tue, 1 Oct 2013 04:52:36 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:cc:content-type; q=dns; s=default; b=iWg7TG/Ge9qwbEk4VX1ujJjsqmPtKHGK34WluLIb9z5 v0+hftzgDB6V0pqvBo1YrsEjOiCeaUoDLydOfBX5Qv0ccq+zyapaPmg38IJjNGrI iHEe3qqrN9zwFWu6cp4nu82uaZzNkD6PtrD8XDyNbFKDY83so8RQ6i8CJuESXNiA = 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 :mime-version:date:message-id:subject:from:to:cc:content-type; s=default; bh=+0uvTpG1mNd5x7C0A5V59dsMDUQ=; b=GwM+DO31tGSthbpy6 Xg58HEW1PiOCAoA9GNo/iGIVmLsr/79m26oy0PRBaEd3PBJkEQcGahkf437QMtBH n/AwToMiCLn99mPpIj8veZgkkt5Ayh6sqc2SbAjYpljfgKgwElHO0gqpVaEL6Xcs /4zpJwcJMh1D3tWCpIgoIetpKc= Received: (qmail 21310 invoked by alias); 30 Sep 2013 18:52:29 -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 21299 invoked by uid 89); 30 Sep 2013 18:52:28 -0000 Received: from mail-qe0-f46.google.com (HELO mail-qe0-f46.google.com) (209.85.128.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 30 Sep 2013 18:52:28 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, NO_RELAYS autolearn=ham version=3.3.2 X-HELO: mail-qe0-f46.google.com Received: by mail-qe0-f46.google.com with SMTP id x7so4149287qeu.33 for ; Mon, 30 Sep 2013 11:52:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc :content-type; bh=Ill+3EA1yHHoTd+hK564T5p1uLO4sGZ6AKGyuMVI4Ow=; b=Nr94wi0ERR7uqJ74buQ4mT3sYPdU3N9tEXn/Ac20dpDF9rzvdT5mCYfrE+EsIlAHEq dsE8fk+lGnr6A7WVXcQBm6TDqgkREFsTZbb0GUr1mgBpdR9KWAZPDhTjCKjTH71rZylC sDku5J64LTTzJo5lE35usKx7Cg2s56uPRlgYkJpaoNl7KAPsre2lWMHHPiLlbb8PjY+J lfcR8gPozCpGRpPTiWVRVsJyKKXOqN35kokRlFcDg3DsCLH3MbUnGFY77tPK1SfmcUg6 7MPfIdwZ8NtrzuBnVLXh6sLJjVELwuVuc8IxF9NaDd3gMLqUjaavqoxkeidBCkcQGFay lBdg== X-Gm-Message-State: ALoCoQn4PryQTwFLxW04fr3qhH5EIt2ZHGtmHecJiTBy1/JrRxQ6EZ7r/xXH/+usS6b8zbRFFnaxD1SkSNKBsflGrHgsfT9soiYfNVmrob0oeQaES5fsWGlgkm1mWYj6am2nTRkcANSHufzBOJbJNbuR0/u7syrxc2GP2gYQilasb4ees7YIONLGr6eSA2vLeTn+Sgl2X8iJZWaUcrmxEPKoKxVTb7oDFw== MIME-Version: 1.0 X-Received: by 10.224.136.136 with SMTP id r8mr15930611qat.37.1380567145835; Mon, 30 Sep 2013 11:52:25 -0700 (PDT) Received: by 10.49.24.225 with HTTP; Mon, 30 Sep 2013 11:52:25 -0700 (PDT) Date: Mon, 30 Sep 2013 11:52:25 -0700 Message-ID: Subject: [Patch] Add missing profile updates to jump threading code From: Teresa Johnson To: Jeff Law , "gcc-patches@gcc.gnu.org" Cc: Jan Hubicka X-IsSubscribed: yes The jump threading handling in the case of a joiner block was not updating profile information (it was being updated in the non-joiner case). Added profile updates for the joiner case, in one place by commoning the handling between the joiner and non-joiner cases. Bootstrapped and tested on x86_64-unknown-linux-gnu. Ok for trunk? Thanks, Teresa 2013-09-30 Teresa Johnson * tree-ssa-threadupdate.c (ssa_fix_duplicate_block_edges): Update redirected out edge count in joiner case. (ssa_redirect_edges): Common the joiner and non-joiner cases so that joiner case gets profile updates. * testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c (expand_one_var): Update for additional dump message. /* { dg-final { cleanup-tree-dump "dom1" } } */ Index: tree-ssa-threadupdate.c =================================================================== --- tree-ssa-threadupdate.c (revision 202947) +++ tree-ssa-threadupdate.c (working copy) @@ -403,6 +403,7 @@ ssa_fix_duplicate_block_edges (struct redirection_ threading through. That's the edge we want to redirect. */ victim = find_edge (rd->dup_block, THREAD_TARGET (e)->dest); e2 = redirect_edge_and_branch (victim, THREAD_TARGET2 (e)->dest); + e2->count = THREAD_TARGET2 (e)->count; /* If we redirected the edge, then we need to copy PHI arguments at the target. If the edge already existed (e2 != victim case), @@ -497,18 +498,8 @@ ssa_redirect_edges (struct redirection_data **slot free (el); thread_stats.num_threaded_edges++; - /* If we are threading through a joiner block, then we have to - find the edge we want to redirect and update some PHI nodes. */ - if (THREAD_TARGET2 (e)) - { - edge e2; - /* We want to redirect the incoming edge to the joiner block (E) - to instead reach the duplicate of the joiner block. */ - e2 = redirect_edge_and_branch (e, rd->dup_block); - flush_pending_stmts (e2); - } - else if (rd->dup_block) + if (rd->dup_block) { edge e2; @@ -522,9 +513,15 @@ ssa_redirect_edges (struct redirection_data **slot the computation overflows. */ if (rd->dup_block->frequency < BB_FREQ_MAX * 2) rd->dup_block->frequency += EDGE_FREQUENCY (e); - EDGE_SUCC (rd->dup_block, 0)->count += e->count; - /* Redirect the incoming edge to the appropriate duplicate - block. */ + + /* In the case of threading through a joiner block, the outgoing + edges from the duplicate block were updated when they were + redirected during ssa_fix_duplicate_block_edges. */ + if (!THREAD_TARGET2 (e)) + EDGE_SUCC (rd->dup_block, 0)->count += e->count; + + /* Redirect the incoming edge (possibly to the joiner block) to the + appropriate duplicate block. */ e2 = redirect_edge_and_branch (e, rd->dup_block); gcc_assert (e == e2); flush_pending_stmts (e2); Index: testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c =================================================================== --- testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c (revision 202947) +++ testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c (working copy) @@ -42,7 +42,7 @@ expand_one_var (tree var, unsigned char toplevel, abort (); } /* We should thread the jump, through an intermediate block. */ -/* { dg-final { scan-tree-dump-times "Threaded" 1 "dom1"} } */ +/* { dg-final { scan-tree-dump-times "Threaded" 2 "dom1"} } */ /* { dg-final { scan-tree-dump-times "Registering jump thread: \\(.*\\) incoming edge; \\(.*\\) joiner; \\(.*\\) nocopy;" 1 "dom1"} } */