From 479189517610591e746369fc4d80302f5cebdbd7 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Fri, 15 Feb 2013 19:17:02 +0000 Subject: [PATCH] re PR rtl-optimization/56348 (internal compiler error in assign_by_spills with -m32 -fPIC -msse2) 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. From-SVN: r196090 --- gcc/ChangeLog | 5 +++++ gcc/lra-assigns.c | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr56348.c | 38 +++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/pr56348.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fda3189..928eef4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-02-15 Vladimir Makarov + + PR rtl-optimization/56348 + * lra-assigns.c (reload_pseudo_compare_func): Prefer bigger pseudos. + 2013-02-15 Steven Bosscher * graph.c (start_graph_dump): Print dumpfile base as digraph label. diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c index 33666fd..b204513 100644 --- a/gcc/lra-assigns.c +++ b/gcc/lra-assigns.c @@ -197,6 +197,12 @@ reload_pseudo_compare_func (const void *v1p, const void *v2p) 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cbee8ae..8d7fabb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-02-15 Vladimir Makarov + + PR rtl-optimization/56348 + * gcc.target/i386/pr56348.c: New test. + 2012-02-15 Greta Yorsh * gcc.target/arm/interrupt-1.c: Fix for thumb mode. diff --git a/gcc/testsuite/gcc.target/i386/pr56348.c b/gcc/testsuite/gcc.target/i386/pr56348.c new file mode 100644 index 0000000..af63828 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr56348.c @@ -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); +} -- 2.7.4