* [pushed][LRA]: Exclude reloading of frame pointer in subreg for some cases
@ 2023-07-20 18:49 Vladimir Makarov
0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2023-07-20 18:49 UTC (permalink / raw)
To: gcc-patches, SenthilKumar.Selvaraj
[-- Attachment #1: Type: text/plain, Size: 208 bytes --]
The following patch improves code for avr LRA port. More explanation
for the patch can be found in the commit message.
The patch was successfully bootstrapped and tested on x86-64, aarch64,
and ppc64le.
[-- Attachment #2: z --]
[-- Type: text/plain, Size: 2010 bytes --]
commit 4b8878fbf7b74ea5c3405c9f558df0517036f131
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date: Thu Jul 20 14:34:26 2023 -0400
[LRA]: Exclude reloading of frame pointer in subreg for some cases
LRA for avr port reloads frame pointer in subreg although we can just
simplify the subreg. It results in generation of bad performance code. The following
patch fixes this.
gcc/ChangeLog:
* lra-constraints.cc (simplify_operand_subreg): Check frame pointer
simplification.
diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index 76a155e99c2..f3784cf5a5b 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -1797,6 +1797,16 @@ simplify_operand_subreg (int nop, machine_mode reg_mode)
alter_subreg (curr_id->operand_loc[nop], false);
return true;
}
+ auto fp_subreg_can_be_simplified_after_reload_p = [] (machine_mode innermode,
+ poly_uint64 offset,
+ machine_mode mode) {
+ reload_completed = 1;
+ bool res = simplify_subreg_regno (FRAME_POINTER_REGNUM,
+ innermode,
+ offset, mode) >= 0;
+ reload_completed = 0;
+ return res;
+ };
/* Force a reload of the SUBREG_REG if this is a constant or PLUS or
if there may be a problem accessing OPERAND in the outer
mode. */
@@ -1809,6 +1819,12 @@ simplify_operand_subreg (int nop, machine_mode reg_mode)
>= hard_regno_nregs (hard_regno, mode))
&& simplify_subreg_regno (hard_regno, innermode,
SUBREG_BYTE (operand), mode) < 0
+ /* Exclude reloading of frame pointer in subreg if frame pointer can not
+ be simplified here only because the reload is not finished yet. */
+ && (hard_regno != FRAME_POINTER_REGNUM
+ || !fp_subreg_can_be_simplified_after_reload_p (innermode,
+ SUBREG_BYTE (operand),
+ mode))
/* Don't reload subreg for matching reload. It is actually
valid subreg in LRA. */
&& ! LRA_SUBREG_P (operand))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-20 18:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20 18:49 [pushed][LRA]: Exclude reloading of frame pointer in subreg for some cases Vladimir Makarov
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).