diff options
author | Vladimir Makarov <vmakarov@redhat.com> | 2012-11-05 16:38:27 +0000 |
---|---|---|
committer | Vladimir Makarov <vmakarov@gcc.gnu.org> | 2012-11-05 16:38:27 +0000 |
commit | 1bdc4b116e7089ebe2cb39075eaf109c36f6167c (patch) | |
tree | 81e55b34555f30dda37645715ae3098efa858274 /gcc | |
parent | 48866799f1b8bc4244a8842507ad657a34ffca67 (diff) | |
download | gcc-1bdc4b116e7089ebe2cb39075eaf109c36f6167c.zip gcc-1bdc4b116e7089ebe2cb39075eaf109c36f6167c.tar.gz gcc-1bdc4b116e7089ebe2cb39075eaf109c36f6167c.tar.bz2 |
re PR rtl-optimization/55151 (ICE: in assign_by_spills, at lra-assigns.c:1217 with -fPIC)
2012-11-05 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/55151
* lra-constraints.c (process_alt_operands): Permit putting reg
value into memory. Increase reject for this case.
2012-11-05 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/55151
* gcc.dg/pr55151.c: New test.
From-SVN: r193170
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lra-constraints.c | 25 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr55151.c | 13 |
4 files changed, 44 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d6a0d56..fd357b4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-11-05 Vladimir Makarov <vmakarov@redhat.com> + + PR rtl-optimization/55151 + * lra-constraints.c (process_alt_operands): Permit putting reg + value into memory. Increase reject for this case. + 2012-11-05 Dehao Chen <dehao@google.com> * final.c (reemit_insn_block_notes): Do not change scope if insn diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index affdc5f..ae8b834 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -1581,7 +1581,9 @@ process_alt_operands (int only_alternative) case TARGET_MEM_CONSTRAINT: if (MEM_P (op) || spilled_pseudo_p (op)) win = true; - if (CONST_POOL_OK_P (mode, op)) + /* We can put constant or pseudo value into memory + to satisfy the constraint. */ + if (CONST_POOL_OK_P (mode, op) || REG_P (op)) badop = false; constmemok = true; break; @@ -1613,7 +1615,10 @@ process_alt_operands (int only_alternative) && offsettable_nonstrict_memref_p (op)) || spilled_pseudo_p (op)) win = true; - if (CONST_POOL_OK_P (mode, op) || MEM_P (op)) + /* We can put constant or pseudo value into memory + or make memory address offsetable to satisfy the + constraint. */ + if (CONST_POOL_OK_P (mode, op) || MEM_P (op) || REG_P (op)) badop = false; constmemok = true; offmemok = true; @@ -1638,6 +1643,7 @@ process_alt_operands (int only_alternative) if (CONST_INT_P (op) || (GET_CODE (op) == CONST_DOUBLE && mode == VOIDmode)) break; + case 'i': if (general_constant_p (op)) win = true; @@ -1702,10 +1708,12 @@ process_alt_operands (int only_alternative) win = true; /* If we didn't already win, we can reload - constants via force_const_mem, and other - MEMs by reloading the address like for + constants via force_const_mem or put the + pseudo value into memory, or make other + memory by reloading the address like for 'o'. */ - if (CONST_POOL_OK_P (mode, op) || MEM_P (op)) + if (CONST_POOL_OK_P (mode, op) + || MEM_P (op) || REG_P (op)) badop = false; constmemok = true; offmemok = true; @@ -1919,6 +1927,13 @@ process_alt_operands (int only_alternative) += ira_reg_class_max_nregs[this_alternative][mode]; } + /* We are trying to spill pseudo into memory. It is + usually more costly than moving to a hard register + although it might takes the same number of + reloads. */ + if (no_regs_p && REG_P (op)) + reject++; + /* Input reloads can be inherited more often than output reloads can be removed, so penalize output reloads. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6626dc9..c310366 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-11-05 Vladimir Makarov <vmakarov@redhat.com> + + PR rtl-optimization/55151 + * gcc.dg/pr55151.c: New test. + 2012-11-05 Jakub Jelinek <jakub@redhat.com> PR debug/54970 diff --git a/gcc/testsuite/gcc.dg/pr55151.c b/gcc/testsuite/gcc.dg/pr55151.c new file mode 100644 index 0000000..1584bf4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr55151.c @@ -0,0 +1,13 @@ +/* PR rtl-optimization/55151 */ +/* { dg-do compile } */ +/* { dg-options "-fPIC" } */ + +int a, b, c, d, e, f, g, h, i, j, k, l; +void f4 (void) +{ + __asm__ volatile ("":[a] "=r,m" (a),[b] "=r,m" (b),[c] "=r,m" (c), + [d] "=r,m" (d),[e] "=r,m" (e),[f] "=r,m" (f), + [g] "=r,m" (g),[h] "=r,m" (h),[i] "=r,m" (i), + [j] "=r,m" (j),[k] "=r,m" (k),[l] "=r,m" (l):"[a],m" (a), + "[j],m" (j), "[k],m" (k), "[l],m" (l)); +} |