aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-01-12 21:04:14 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-01-12 21:04:14 +0100
commitd508a932f1c7b46c768db0da7f0dc726c4e2e141 (patch)
tree53ac19b200822ae3cb46fd98384376e7fad1b01a
parent708c4094eea2574473207a45d747994c9c2cbb56 (diff)
downloadgcc-d508a932f1c7b46c768db0da7f0dc726c4e2e141.zip
gcc-d508a932f1c7b46c768db0da7f0dc726c4e2e141.tar.gz
gcc-d508a932f1c7b46c768db0da7f0dc726c4e2e141.tar.bz2
regrename.c (regrename_do_replace): If replacing the same reg multiple times, try to reuse last created gen_raw_REG.
* regrename.c (regrename_do_replace): If replacing the same reg multiple times, try to reuse last created gen_raw_REG. From-SVN: r256596
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/regrename.c17
2 files changed, 15 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4b4b577..d3bd144 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
2018-01-12 Jakub Jelinek <jakub@redhat.com>
+ * regrename.c (regrename_do_replace): If replacing the same
+ reg multiple times, try to reuse last created gen_raw_REG.
+
PR debug/81155
* bb-reorder.c (pass_partition_blocks::gate): In lto don't partition
main to workaround a bug in GDB.
@@ -1394,7 +1397,7 @@
2018-01-04 Jakub Jelinek <jakub@redhat.com>
PR debug/83666
- * cfgexpand.c (expand_dbeug_expr) <case BIT_FIELD_REF>: Punt if mode
+ * cfgexpand.c (expand_debug_expr) <case BIT_FIELD_REF>: Punt if mode
is BLKmode and bitpos not zero or mode change is needed.
2018-01-04 Richard Sandiford <richard.sandiford@linaro.org>
diff --git a/gcc/regrename.c b/gcc/regrename.c
index f930a65..dcec77a 100644
--- a/gcc/regrename.c
+++ b/gcc/regrename.c
@@ -963,6 +963,7 @@ regrename_do_replace (struct du_head *head, int reg)
struct du_chain *chain;
unsigned int base_regno = head->regno;
machine_mode mode;
+ rtx last_reg = NULL_RTX, last_repl = NULL_RTX;
for (chain = head->first; chain; chain = chain->next_use)
{
@@ -975,12 +976,16 @@ regrename_do_replace (struct du_head *head, int reg)
gen_rtx_UNKNOWN_VAR_LOC (), true);
else
{
- validate_change (chain->insn, chain->loc,
- gen_raw_REG (GET_MODE (*chain->loc), reg), true);
- if (regno >= FIRST_PSEUDO_REGISTER)
- ORIGINAL_REGNO (*chain->loc) = regno;
- REG_ATTRS (*chain->loc) = attr;
- REG_POINTER (*chain->loc) = reg_ptr;
+ if (*chain->loc != last_reg)
+ {
+ last_repl = gen_raw_REG (GET_MODE (*chain->loc), reg);
+ if (regno >= FIRST_PSEUDO_REGISTER)
+ ORIGINAL_REGNO (last_repl) = regno;
+ REG_ATTRS (last_repl) = attr;
+ REG_POINTER (last_repl) = reg_ptr;
+ last_reg = *chain->loc;
+ }
+ validate_change (chain->insn, chain->loc, last_repl, true);
}
}