From patchwork Fri Feb 15 19:17:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 220824 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]) by ozlabs.org (Postfix) with SMTP id 6D84F2C0089 for ; Sat, 16 Feb 2013 06:18:07 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1361560687; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=hSUGIkq fJyMQSa4Pdzwkumqofx8=; b=e/uGvN0m2WHloM4CxK2CnyY1gVL4g+iZiID7Ihm 3LXWYjJdx9jWfQmK/UVGxz4z7Oy3AQq2MRDg9+2KeoFNZhI9kTWNeKbULEzs6P/1 y1NatskJuUxqfZbgRg56dy4gsNySBWoxqYLMccYk85drQTh+A8prgohfvIaGxhDq 7lc8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=l01CA7hmkGfRdv43ULsoMEGQUG1opIcUL/1PwAcRgklvsmSgLp4iFGEifgkjGK cSeSsj16NlJkrySwD58+zWG3y6+iT7bxBi7aJd+NwZWpaKhu0C67LftApl8ZEHe3 asnjyekSCzk7ks+Fz96qBZlnq/tQ2WiMk+o3ErMyxIwPU=; Received: (qmail 23396 invoked by alias); 15 Feb 2013 19:17:53 -0000 Received: (qmail 23381 invoked by uid 22791); 15 Feb 2013 19:17:52 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, KHOP_SPAMHAUS_DROP, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Feb 2013 19:17:45 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1FJHieL001463 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Feb 2013 14:17:44 -0500 Received: from Mair.local (vpn-51-83.rdu2.redhat.com [10.10.51.83]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1FJHh0a021074 for ; Fri, 15 Feb 2013 14:17:44 -0500 Message-ID: <511E89D7.20002@redhat.com> Date: Fri, 15 Feb 2013 14:17:43 -0500 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 MIME-Version: 1.0 To: gcc Patches Subject: patch to fix PR56348 X-IsSubscribed: yes 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 The following patch fixes PR56348. The details of the problem are given on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56348 The patch was successfully bootstrapped and tested on x86/x86-64. Committed as rev. 196090. 2013-02-15 Vladimir Makarov PR rtl-optimization/56348 * lra-assigns.c (reload_pseudo_compare_func): Prefer bigger pseudos. 2013-02-15 Vladimir Makarov PR rtl-optimization/56348 * gcc.target/i386/pr56348.c: New test. Index: lra-assigns.c =================================================================== --- lra-assigns.c (revision 196081) +++ lra-assigns.c (working copy) @@ -197,6 +197,12 @@ reload_pseudo_compare_func (const void * if ((diff = (regno_assign_info[regno_assign_info[r2].first].freq - regno_assign_info[regno_assign_info[r1].first].freq)) != 0) return diff; + /* Allocate bigger pseudos first to avoid register file + fragmentation. */ + if ((diff + = (ira_reg_class_max_nregs[cl2][lra_reg_info[r2].biggest_mode] + - ira_reg_class_max_nregs[cl1][lra_reg_info[r1].biggest_mode])) != 0) + return diff; /* Put pseudos from the thread nearby. */ if ((diff = regno_assign_info[r1].first - regno_assign_info[r2].first) != 0) return diff; Index: testsuite/gcc.target/i386/pr56348.c =================================================================== --- testsuite/gcc.target/i386/pr56348.c (revision 0) +++ testsuite/gcc.target/i386/pr56348.c (working copy) @@ -0,0 +1,38 @@ +/* PR target/56348 */ +/* { dg-do compile { target { ia32 } } } */ +/* { dg-options "-O2 -fPIC -mfpmath=sse -msse2" } */ + +typedef unsigned int size_t; + +extern double fabs (double __x) __attribute__ ((__nothrow__, __leaf__)) + __attribute__ ((__const__)); + +typedef struct cholmod_sparse_struct +{ + size_t ncol; + void *p; +} cholmod_sparse; + +int cholmod_l_reallocate_sparse (size_t, cholmod_sparse *, void *); + +int +cholmod_l_drop (double tol, cholmod_sparse * A) +{ + double aij; + double *Ax; + long long *Ap, *Ai, *Anz; + long long packed, i, j, nrow, ncol, p, pend, nz, values; + Ap = A->p; + ncol = A->ncol; + nz = 0; + for (j = 0; j < ncol; j++) + for (; p < pend; p++) + { + i = Ai[p]; + aij = Ax[p]; + if (i <= j && (fabs (aij) > tol || ((aij) != (aij)))) + nz++; + } + Ap[ncol] = nz; + cholmod_l_reallocate_sparse (nz, A, 0); +}