diff options
author | Vladimir Makarov <vmakarov@redhat.com> | 2016-06-09 21:28:31 +0000 |
---|---|---|
committer | Jiong Wang <jiwang@gcc.gnu.org> | 2016-06-09 21:28:31 +0000 |
commit | 5f225ef44a2705e6dde737b03f69eba0739f8b5f (patch) | |
tree | 996e1e2c32600d920b281eb55a667aed2f1fa05e | |
parent | 8760ebd759e127e58522ed64f3fe09585372a8f0 (diff) | |
download | gcc-5f225ef44a2705e6dde737b03f69eba0739f8b5f.zip gcc-5f225ef44a2705e6dde737b03f69eba0739f8b5f.tar.gz gcc-5f225ef44a2705e6dde737b03f69eba0739f8b5f.tar.bz2 |
[Patch] PR70751, correct the cost for spilling non-pseudo into memory
PR rtl-optimization/70751
* lra-constraints.c (process_alt_operands): Recognize Non-pseudo spilled
into memory.
Co-Authored-By: Jiong Wang <jiong.wang@arm.com>
From-SVN: r237277
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/lra-constraints.c | 21 |
2 files changed, 24 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 274155f..b27dd3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-06-09 Vladimir Makarov <vmakarov@redhat.com> + Jiong Wang <jiong.wang@arm.com> + + PR rtl-optimization/70751 + * lra-constraints.c (process_alt_operands): Recognize Non-pseudo spilled + into memory. + 2016-06-09 Jonathan Yong <10walls@gmail.com> Revert: diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index e4e6c8c..bf08dce 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -2474,14 +2474,27 @@ process_alt_operands (int only_alternative) /* 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) && hard_regno[nop] >= 0) + reloads. + + Non-pseudo spill may happen also. Suppose a target allows both + register and memory in the operand constraint alternatives, + then it's typical that an eliminable register has a substition + of "base + offset" which can either be reloaded by a simple + "new_reg <= base + offset" which will match the register + constraint, or a similar reg addition followed by further spill + to and reload from memory which will match the memory + constraint, but this memory spill will be much more costly + usually. + + Code below increases the reject for both pseudo and non-pseudo + spill. */ + if (no_regs_p && !(REG_P (op) && hard_regno[nop] < 0)) { if (lra_dump_file != NULL) fprintf (lra_dump_file, - " %d Spill pseudo into memory: reject+=3\n", - nop); + " %d Spill %spseudo into memory: reject+=3\n", + nop, REG_P (op) ? "" : "Non-"); reject += 3; if (VECTOR_MODE_P (mode)) { |