public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] Undo multi-word optional reloads
@ 2022-02-25 20:22 Alexandre Oliva
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2022-02-25 20:22 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3ee8f48e1a752ae4dd80426019691ec8994040a1
commit 3ee8f48e1a752ae4dd80426019691ec8994040a1
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Feb 25 17:16:14 2022 -0300
Undo multi-word optional reloads
Diff:
---
gcc/lra-constraints.cc | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index b2c4590153c..b0b75ddf72b 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -7261,15 +7261,17 @@ undo_optional_reloads (void)
continue;
src = SET_SRC (set);
dest = SET_DEST (set);
- if (! REG_P (src) || ! REG_P (dest))
+ if ((! REG_P (src) && ! SUBREG_P (src))
+ || (! REG_P (dest) && ! SUBREG_P (dest)))
continue;
- if (REGNO (dest) == regno
+ if (get_regno (dest) == (int) regno
/* Ignore insn for optional reloads itself. */
- && REGNO (lra_reg_info[regno].restore_rtx) != REGNO (src)
+ && (get_regno (lra_reg_info[regno].restore_rtx)
+ != get_regno (src))
/* Check only inheritance on last inheritance pass. */
- && (int) REGNO (src) >= new_regno_start
+ && get_regno (src) >= new_regno_start
/* Check that the optional reload was inherited. */
- && bitmap_bit_p (&lra_inheritance_pseudos, REGNO (src)))
+ && bitmap_bit_p (&lra_inheritance_pseudos, get_regno (src)))
{
keep_p = true;
break;
@@ -7291,18 +7293,21 @@ undo_optional_reloads (void)
bitmap_copy (insn_bitmap, &lra_reg_info[regno].insn_bitmap);
EXECUTE_IF_SET_IN_BITMAP (insn_bitmap, 0, uid, bi2)
{
+ if (!lra_insn_recog_data[uid])
+ continue;
insn = lra_insn_recog_data[uid]->insn;
if ((set = single_set (insn)) != NULL_RTX)
{
src = SET_SRC (set);
dest = SET_DEST (set);
- if (REG_P (src) && REG_P (dest)
- && ((REGNO (src) == regno
- && (REGNO (lra_reg_info[regno].restore_rtx)
- == REGNO (dest)))
- || (REGNO (dest) == regno
- && (REGNO (lra_reg_info[regno].restore_rtx)
- == REGNO (src)))))
+ if ((REG_P (src) || SUBREG_P (src))
+ && (REG_P (dest) || SUBREG_P (dest))
+ && ((get_regno (src) == (int) regno
+ && (get_regno (lra_reg_info[regno].restore_rtx)
+ == get_regno (dest)))
+ || (get_regno (dest) == (int) regno
+ && (get_regno (lra_reg_info[regno].restore_rtx)
+ == get_regno (src)))))
{
if (lra_dump_file != NULL)
{
@@ -7310,7 +7315,7 @@ undo_optional_reloads (void)
INSN_UID (insn));
dump_insn_slim (lra_dump_file, insn);
}
- delete_move_and_clobber (insn, REGNO (dest));
+ delete_move_and_clobber (insn, get_regno (dest));
continue;
}
/* We should not worry about generation memory-memory
@@ -7319,6 +7324,11 @@ undo_optional_reloads (void)
we remove the inheritance pseudo and the optional
reload. */
}
+ if (GET_CODE (PATTERN (insn)) == CLOBBER
+ && REG_P (SET_DEST (insn))
+ && get_regno (dest) == (int) regno)
+ /* Refuse to remap clobbers to preexisting pseudos. */
+ gcc_unreachable ();
lra_substitute_pseudo_within_insn
(insn, regno, lra_reg_info[regno].restore_rtx, false);
lra_update_insn_regno_info (insn);
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] Undo multi-word optional reloads
@ 2022-02-25 21:49 Alexandre Oliva
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2022-02-25 21:49 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c646fb827a5493f83d896209701e5b4bb754ad12
commit c646fb827a5493f83d896209701e5b4bb754ad12
Author: Alexandre Oliva <oliva@adacore.com>
Date: Fri Feb 25 17:16:14 2022 -0300
Undo multi-word optional reloads
Diff:
---
gcc/lra-constraints.cc | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index b2c4590153c..6f930cd3a57 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -7261,15 +7261,17 @@ undo_optional_reloads (void)
continue;
src = SET_SRC (set);
dest = SET_DEST (set);
- if (! REG_P (src) || ! REG_P (dest))
+ if ((! REG_P (src) && ! SUBREG_P (src))
+ || (! REG_P (dest) && ! SUBREG_P (dest)))
continue;
- if (REGNO (dest) == regno
+ if (get_regno (dest) == (int) regno
/* Ignore insn for optional reloads itself. */
- && REGNO (lra_reg_info[regno].restore_rtx) != REGNO (src)
+ && (get_regno (lra_reg_info[regno].restore_rtx)
+ != get_regno (src))
/* Check only inheritance on last inheritance pass. */
- && (int) REGNO (src) >= new_regno_start
+ && get_regno (src) >= new_regno_start
/* Check that the optional reload was inherited. */
- && bitmap_bit_p (&lra_inheritance_pseudos, REGNO (src)))
+ && bitmap_bit_p (&lra_inheritance_pseudos, get_regno (src)))
{
keep_p = true;
break;
@@ -7291,18 +7293,21 @@ undo_optional_reloads (void)
bitmap_copy (insn_bitmap, &lra_reg_info[regno].insn_bitmap);
EXECUTE_IF_SET_IN_BITMAP (insn_bitmap, 0, uid, bi2)
{
+ if (!lra_insn_recog_data[uid])
+ continue;
insn = lra_insn_recog_data[uid]->insn;
if ((set = single_set (insn)) != NULL_RTX)
{
src = SET_SRC (set);
dest = SET_DEST (set);
- if (REG_P (src) && REG_P (dest)
- && ((REGNO (src) == regno
- && (REGNO (lra_reg_info[regno].restore_rtx)
- == REGNO (dest)))
- || (REGNO (dest) == regno
- && (REGNO (lra_reg_info[regno].restore_rtx)
- == REGNO (src)))))
+ if ((REG_P (src) || SUBREG_P (src))
+ && (REG_P (dest) || SUBREG_P (dest))
+ && ((get_regno (src) == (int) regno
+ && (get_regno (lra_reg_info[regno].restore_rtx)
+ == get_regno (dest)))
+ || (get_regno (dest) == (int) regno
+ && (get_regno (lra_reg_info[regno].restore_rtx)
+ == get_regno (src)))))
{
if (lra_dump_file != NULL)
{
@@ -7310,7 +7315,7 @@ undo_optional_reloads (void)
INSN_UID (insn));
dump_insn_slim (lra_dump_file, insn);
}
- delete_move_and_clobber (insn, REGNO (dest));
+ delete_move_and_clobber (insn, get_regno (dest));
continue;
}
/* We should not worry about generation memory-memory
@@ -7319,6 +7324,11 @@ undo_optional_reloads (void)
we remove the inheritance pseudo and the optional
reload. */
}
+ if (GET_CODE (PATTERN (insn)) == CLOBBER
+ && REG_P (SET_DEST (insn))
+ && get_regno (SET_DEST (insn)) == (int) regno)
+ /* Refuse to remap clobbers to preexisting pseudos. */
+ gcc_unreachable ();
lra_substitute_pseudo_within_insn
(insn, regno, lra_reg_info[regno].restore_rtx, false);
lra_update_insn_regno_info (insn);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-25 21:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25 20:22 [gcc(refs/users/aoliva/heads/testme)] Undo multi-word optional reloads Alexandre Oliva
2022-02-25 21:49 Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).