From patchwork Thu Jun 27 17:15:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Easwaran Raman X-Patchwork-Id: 255112 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 991A72C00A1 for ; Fri, 28 Jun 2013 03:15:37 +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=E52wjNE7kCd2LQcQaUA+zTjRYJRUZ8x5QsKLmPWmas2 6oUe77PLT02GjtcE/PaBvraHwFDtcpyr5WUYGJG4HKKy/jmmqp/xxhd3kg94LmaU P/q4pKxhiu1RIJZA8SGmigXjLbaaSPof5TkoJFQDq31/3mWInGsu4gS78q42UAEw = 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=UYT1aUv+cfZA620aUBy7gYPfzhQ=; b=eBiUd3b16SREjtOxE OLJ3kLpxfZwwldaqstoxy+UEmKQeeJRkvtEV+iVFMqDidaHzwE1QgZzCwFJPI1VS Cm6maOg1JjkCgKuhftmaB3OYYAeWwVPl310gIxSzeef05lXGutLU64vIeUTalVEV CAOupWAkSCC0VBVvWvsAk8hs3A= Received: (qmail 19779 invoked by alias); 27 Jun 2013 17:15:30 -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 19769 invoked by uid 89); 27 Jun 2013 17:15:30 -0000 X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.1 Received: from mail-qa0-f41.google.com (HELO mail-qa0-f41.google.com) (209.85.216.41) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 27 Jun 2013 17:15:29 +0000 Received: by mail-qa0-f41.google.com with SMTP id f14so2667266qak.0 for ; Thu, 27 Jun 2013 10:15:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=vrqFJljzHGn0njz+mJmRJn9D6ftvhq7X77ARS0r/cUA=; b=WE1NbCpTQpQuxIyinYerim9fBMha3HRmi32vtNBYsTHB0XYFyAs7uU5Rdhps4uZ0tn DOhQU+QwCcXotCFx5/ftiqSABwEn1Jb3JU8I4C0s30XbYrHgqdvEvz+rASpVpYS6FHmN h6cSOqPXvZ+sXlp8JeSPEXN9Jt2dwMbkErc0bMAg1DsYp2I0oOXJLlY57057Jg4tkI91 RkZRlKrZvIk8MHNRGbeqwLSHi0WYvbWZ8QcZWCN3hh/Z/JgRid+xjGf1RVTXuRHSDpaX jJOKwismkAu0NaOqxE+2YPUmOAnJ0lPvcR6qv+BPP7SjSLvp+g/ZNtn9yzWxbgeiW0tl Wrwg== MIME-Version: 1.0 X-Received: by 10.49.83.37 with SMTP id n5mr11906942qey.57.1372353327135; Thu, 27 Jun 2013 10:15:27 -0700 (PDT) Received: by 10.229.177.7 with HTTP; Thu, 27 Jun 2013 10:15:27 -0700 (PDT) Date: Thu, 27 Jun 2013 10:15:27 -0700 Message-ID: Subject: Fix PR middle-end/57370 From: Easwaran Raman To: gcc-patches@gcc.gnu.org Cc: Richard Biener X-Gm-Message-State: ALoCoQnQDg22ComUYMqVEcDZ23ovj0tcJXuUABdGP+iVW0e+V1FeJQaRINyXchnWnzxMeme+witmthz8hTj94r7JL/3Pn1FaOdLkozPy4V9grE7utx0HFQSwwVT0pXhujIwMOPOVSn/EjNUS2BCy8dkaveJOwsgzfu5C6XyYBffqf3TK/K9Q+H1HExNpOw+05KKtWDaViBdARm3+GjT8j6EjYdCYN8lVoQ== A newly generated statement in build_and_add_sum function of tree-ssa-reassoc.c has to be assigned the UID of its adjacent statement. In one instance, it was assigned the wrong uid (of an earlier phi statement) which messed up the IR and caused the test program to hang. Bootstraps and no test regressions on x86_64/linux. Ok for trunk? Thanks, Easwaran 2013-06-27 Easwaran Raman PR middle-end/57370 * tree-ssa-reassoc.c (build_and_add_sum): Do not use the UID of a phi node for a non-phi gimple statement. testsuite/ChangeLog: 2013-06-27 Easwaran Raman PR middle-end/57370 * gfortran.dg/reassoc_12.f90: New testcase. Index: gcc/testsuite/gfortran.dg/reassoc_12.f90 =================================================================== --- gcc/testsuite/gfortran.dg/reassoc_12.f90 (revision 0) +++ gcc/testsuite/gfortran.dg/reassoc_12.f90 (revision 0) @@ -0,0 +1,74 @@ +! { dg-do compile } +! { dg-options "-O2 -ffast-math" } +! PR middle-end/57370 + + SUBROUTINE xb88_lr_adiabatic_lda_calc(e_ndrho_ndrho_ndrho, & + grad_deriv,npoints, sx) + IMPLICIT REAL*8 (t) + INTEGER, PARAMETER :: dp=8 + REAL(kind=dp), DIMENSION(1:npoints) :: e_ndrho_ndrho_ndrho, & + e_ndrho_ndrho_rho + DO ii=1,npoints + IF( grad_deriv >= 2 .OR. grad_deriv == -2 ) THEN + t1425 = t233 * t557 + t1429 = beta * t225 + t1622 = t327 * t1621 + t1626 = t327 * t1625 + t1632 = t327 * t1631 + t1685 = t105 * t1684 + t2057 = t1636 + t8 * (t2635 + t3288) + END IF + IF( grad_deriv >= 3 .OR. grad_deriv == -3 ) THEN + t5469 = t5440 - t5443 - t5446 - t5449 - & + t5451 - t5454 - t5456 + t5459 - & + t5462 + t5466 - t5468 + t5478 = 0.240e2_dp * t1616 * t973 * t645 * t1425 + t5489 = 0.1600000000e2_dp * t1429 * t1658 + t5531 = 0.160e2_dp * t112 * t1626 + t5533 = 0.160e2_dp * t112 * t1632 + t5537 = 0.160e2_dp * t112 * t1622 + t5541 = t5472 - t5478 - t5523 + t5525 + & + t5531 + t5533 + t5535 + t5537 + & + t5540 + t5565 = t112 * t1685 + t5575 = t5545 - t5548 + t5551 + t5553 - & + t5558 + t5560 - t5562 + t5564 - & + 0.80e1_dp * t5565 + t5568 + t5572 + & + t5574 + t5611 = t5579 - t5585 + t5590 - t5595 + & + t5597 - t5602 + t5604 + t5607 + & + t5610 + t5613 = t5469 + t5541 + t5575 + t5611 + t6223 = t6189 - & + 0.3333333336e0_dp * t83 * t84 * t5613 + & + t6222 + t6227 = - t8 * (t5305 + t6223) + e_ndrho_ndrho_rho(ii) = e_ndrho_ndrho_rho(ii) + & + t6227 * sx + t6352 = t5440 - t5443 - t5446 - t5449 - & + t5451 - t5454 + & + 0.40e1_dp * t102 * t327 * t2057 * t557 - & + t5456 + t5459 - t5462 + t5466 - & + t5468 + t6363 = t5480 - t5489 + & + 0.9600000000e2_dp * t1054 * t640 * t3679 + t6367 = t5472 - t5474 - t5478 - t5523 + & + t5525 + t5531 + t5533 + t5535 + & + t5537 - 0.20e1_dp * t102 * t105 * t6363 + & + t5540 + t6370 = t5545 - t5548 + t5551 + t5553 - & + t5558 + t5560 - t5562 + t5564 - & + 0.40e1_dp * t5565 + & + t5568 + t5572 + t5574 + t6373 = t5579 - t5585 + t5590 - t5595 + & + t5597 - t5602 + t5604 + t5607 + & + t5610 + t6375 = t6352 + t6367 + t6370 + t6373 + t6380 = - 0.3333333336e0_dp * t83 * t84 * t6375 + t5701 + t6669 = -t4704 - t8 * (t6344 + t6380 + t6665) + e_ndrho_ndrho_ndrho(ii) = e_ndrho_ndrho_ndrho(ii) + & + t6669 * sx + END IF + END DO + END SUBROUTINE xb88_lr_adiabatic_lda_calc + Index: gcc/tree-ssa-reassoc.c =================================================================== --- gcc/tree-ssa-reassoc.c (revision 200429) +++ gcc/tree-ssa-reassoc.c (working copy) @@ -1207,7 +1207,7 @@ build_and_add_sum (tree type, tree op1, tree op2, if (gimple_code (op1def) == GIMPLE_PHI) { gsi = gsi_after_labels (gimple_bb (op1def)); - gimple_set_uid (sum, gimple_uid (op1def)); + gimple_set_uid (sum, gimple_uid (gsi_stmt (gsi))); gsi_insert_before (&gsi, sum, GSI_NEW_STMT); } else