public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-5738] Revert "RA: Implement reuse of equivalent memory for caller saves optimization"
@ 2023-02-08 13:28 Vladimir Makarov
0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2023-02-08 13:28 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ad2bd0ad0413c2448fee0d4a062dd52ca8a75e8c
commit r13-5738-gad2bd0ad0413c2448fee0d4a062dd52ca8a75e8c
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date: Wed Feb 8 08:25:10 2023 -0500
Revert "RA: Implement reuse of equivalent memory for caller saves optimization"
This reverts commit f661c0bb6371f355966a67b5ce71398e80792948.
Diff:
---
gcc/ira.cc | 20 +++-----------------
gcc/ira.h | 5 +----
gcc/lra-constraints.cc | 15 ++++++---------
gcc/testsuite/gcc.target/i386/pr103541.c | 14 --------------
4 files changed, 10 insertions(+), 44 deletions(-)
diff --git a/gcc/ira.cc b/gcc/ira.cc
index c6ee46286bc..66df03e8a59 100644
--- a/gcc/ira.cc
+++ b/gcc/ira.cc
@@ -3070,8 +3070,6 @@ validate_equiv_mem_from_store (rtx dest, const_rtx set ATTRIBUTE_UNUSED,
info->equiv_mem_modified = true;
}
-static int equiv_init_varies_p (rtx x);
-
enum valid_equiv { valid_none, valid_combine, valid_reload };
/* Verify that no store between START and the death of REG invalidates
@@ -3115,8 +3113,7 @@ validate_equiv_mem (rtx_insn *start, rtx reg, rtx memref)
been changed and all hell breaks loose. */
ret = valid_combine;
if (!MEM_READONLY_P (memref)
- && (!RTL_CONST_OR_PURE_CALL_P (insn)
- || equiv_init_varies_p (XEXP (memref, 0))))
+ && !RTL_CONST_OR_PURE_CALL_P (insn))
return valid_none;
}
@@ -3769,18 +3766,7 @@ update_equiv_regs (void)
{
replacement = copy_rtx (SET_SRC (set));
if (validity == valid_reload)
- {
- note = set_unique_reg_note (insn, REG_EQUIV, replacement);
- }
- else
- {
- /* We still can use this equivalence for caller save
- optimization in LRA. Mark this. */
- ira_reg_equiv[regno].caller_save_p = true;
- ira_reg_equiv[regno].init_insns
- = gen_rtx_INSN_LIST (VOIDmode, insn,
- ira_reg_equiv[regno].init_insns);
- }
+ note = set_unique_reg_note (insn, REG_EQUIV, replacement);
}
}
@@ -4170,7 +4156,7 @@ setup_reg_equiv (void)
legitimate, we ignore such REG_EQUIV notes. */
if (memory_operand (x, VOIDmode))
{
- ira_reg_equiv[i].defined_p = !ira_reg_equiv[i].caller_save_p;
+ ira_reg_equiv[i].defined_p = true;
ira_reg_equiv[i].memory = x;
continue;
}
diff --git a/gcc/ira.h b/gcc/ira.h
index 3d35025a46e..58b50dbe8a2 100644
--- a/gcc/ira.h
+++ b/gcc/ira.h
@@ -175,11 +175,8 @@ extern struct target_ira *this_target_ira;
/* Major structure describing equivalence info for a pseudo. */
struct ira_reg_equiv_s
{
- /* True if we can use this as a general equivalence. */
+ /* True if we can use this equivalence. */
bool defined_p;
- /* True if we can use this equivalence only for caller save/restore
- location. */
- bool caller_save_p;
/* True if the usage of the equivalence is profitable. */
bool profitable_p;
/* Equiv. memory, constant, invariant, and initializing insns of
diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index dd4f68bbfc0..7bffbc07ee2 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -5771,17 +5771,14 @@ choose_split_class (enum reg_class allocno_class,
return best_cl;
}
-/* Copy any equivalence information from ORIGINAL_REGNO to NEW_REGNO. It only
- makes sense to call this function if NEW_REGNO is always equal to
- ORIGINAL_REGNO. Set up defined_p flag when caller_save_p flag is set up and
- CALL_SAVE_P is true. */
+/* Copy any equivalence information from ORIGINAL_REGNO to NEW_REGNO.
+ It only makes sense to call this function if NEW_REGNO is always
+ equal to ORIGINAL_REGNO. */
static void
-lra_copy_reg_equiv (unsigned int new_regno, unsigned int original_regno,
- bool call_save_p)
+lra_copy_reg_equiv (unsigned int new_regno, unsigned int original_regno)
{
- if (!ira_reg_equiv[original_regno].defined_p
- && !(call_save_p && ira_reg_equiv[original_regno].caller_save_p))
+ if (!ira_reg_equiv[original_regno].defined_p)
return;
ira_expand_reg_equiv ();
@@ -5961,7 +5958,7 @@ split_reg (bool before_p, int original_regno, rtx_insn *insn,
rematerializing the original value instead of spilling to the stack. */
if (!HARD_REGISTER_NUM_P (original_regno)
&& mode == PSEUDO_REGNO_MODE (original_regno))
- lra_copy_reg_equiv (new_regno, original_regno, call_save_p);
+ lra_copy_reg_equiv (new_regno, original_regno);
lra_reg_info[new_regno].restore_rtx = regno_reg_rtx[original_regno];
bitmap_set_bit (&lra_split_regs, new_regno);
if (to != NULL)
diff --git a/gcc/testsuite/gcc.target/i386/pr103541.c b/gcc/testsuite/gcc.target/i386/pr103541.c
deleted file mode 100644
index 72b257d42ee..00000000000
--- a/gcc/testsuite/gcc.target/i386/pr103541.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* PR rtl-optimization/103541 */
-/* { dg-do compile { target x86_64-*-* } } */
-/* { dg-options "-O2" } */
-
-float a;
-__attribute__((const)) float foo (float);
-
-float
-test()
-{
- return a + foo(a) + a;
-}
-
-/* { dg-final { scan-assembler-not "\\\(%rsp\\\)" } } */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-02-08 13:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08 13:28 [gcc r13-5738] Revert "RA: Implement reuse of equivalent memory for caller saves optimization" 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).