From patchwork Mon May 20 03:31:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Ju Wu X-Patchwork-Id: 244838 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 CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 6CC062C0103 for ; Mon, 20 May 2013 13:32:07 +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:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=dd3mo9rBBftGZkSQYf je89YCMIm68qxovbw5+XT11QZI6xamNdQF53SnRMVfXj2UMDMdL4uX85+Pr3q++I 4+xMcFLaHsFMX8KoCA4K8/USLq9axqs9ff3+HxgKSFGhlrraANXef+yVC1e9gaDA 6GzfiNmNayEaF2JkkF7Qzy7xs= 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:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=Wk7pCwthcuDl4d9/1cKBV43a gpA=; b=FYu6ruhm+vT3imIh12drOgR4VBQlMXlehcwTTNRdQFrg5wciId/CDv8J 5dCLzoa9eUh9QBbz7uVwDCqtpF5ZtcKvVc8H8riIT8Sf8wgKyQEIX0CZ7TuFR89T dLq6Rov7dp4RTVNEwH6PurMtsjWj9eEYR9qgYyoDfukyFatERc4= Received: (qmail 11512 invoked by alias); 20 May 2013 03:32:00 -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 11484 invoked by uid 89); 20 May 2013 03:31:56 -0000 X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KHOP_THREADED, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_YE, SPF_PASS, TW_TM, TW_UC autolearn=ham version=3.3.1 Received: from mail-pd0-f177.google.com (HELO mail-pd0-f177.google.com) (209.85.192.177) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 20 May 2013 03:31:54 +0000 Received: by mail-pd0-f177.google.com with SMTP id u11so295683pdi.8 for ; Sun, 19 May 2013 20:31:53 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.68.201.5 with SMTP id jw5mr8544198pbc.40.1369020713376; Sun, 19 May 2013 20:31:53 -0700 (PDT) Received: by 10.68.143.227 with HTTP; Sun, 19 May 2013 20:31:53 -0700 (PDT) In-Reply-To: References: Date: Mon, 20 May 2013 11:31:53 +0800 Message-ID: Subject: Re: Fix PR tree-optimization/57322 From: Chung-Ju Wu To: Easwaran Raman Cc: gcc patches 2013/5/20 Easwaran Raman : > The UID of a newly generated statement in build_and_add_sum is set to > that of an adjacent statement in the BB. This is a problem in one case > where the BB is empty. This fix sets the UID to be 1 if the BB is > empty. Bootstraps and no test regressions on x86_64 . OK for trunk? > > Thanks, > Easwaran > > ----------- > > 2013-05-19 Easwaran Raman > > PR tree-optimization/57322 > * (build_and_add_sum): If a BB is empty, set the UID of the statement > added to the BB to be 1. > > Index: gcc/tree-ssa-reassoc.c > =================================================================== > --- gcc/tree-ssa-reassoc.c (revision 199048) > +++ gcc/tree-ssa-reassoc.c (working copy) > @@ -1165,8 +1165,12 @@ build_and_add_sum (tree type, tree op1, tree op2, > if ((!op1def || gimple_nop_p (op1def)) > && (!op2def || gimple_nop_p (op2def))) > { > + gimple first_stmt; > + unsigned uid; > gsi = gsi_after_labels (single_succ (ENTRY_BLOCK_PTR)); > - gimple_set_uid (sum, gimple_uid (gsi_stmt (gsi))); > + first_stmt = gsi_stmt (gsi); > + uid = first_stmt ? gimple_uid (first_stmt) : 1; > + gimple_set_uid (sum, uid); > gsi_insert_before (&gsi, sum, GSI_NEW_STMT); > } > else if ((!op1def || gimple_nop_p (op1def)) How about having a new testcase? The followings are the ChangeLog and new testcase for your patch fix. (By the way, I notice there are three space characters after date "2013-05-17" in your previous ChangeLog patch. I think there should be only two space characters. So I modified it as well.) Best regards, jasonwucj Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (revision 199075) +++ gcc/testsuite/ChangeLog (working copy) @@ -1,5 +1,10 @@ -2013-05-17 Easwaran Raman +2013-05-20 Easwaran Raman + PR tree-optimization/57322 + * gcc.dg/pr57322.c: New test. + +2013-05-17 Easwaran Raman + * gcc.dg/tree-ssa/reassoc-28.c: New testcase. 2013-05-17 Marc Glisse Index: gcc/testsuite/gcc.dg/pr57322.c =================================================================== --- gcc/testsuite/gcc.dg/pr57322.c (revision 0) +++ gcc/testsuite/gcc.dg/pr57322.c (revision 0) @@ -0,0 +1,15 @@ +/* PR tree-optimization/57322 */ +/* { dg-do compile } */ +/* { dg-options "-w -O1" } */ +int a; + +void f (void) +{ + char b; + + for (;; a++) + { + char *p = &b, *q; + *q = b < 0 & !!*p; + } +}