public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "chenglulu at loongson dot cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/109035] meaningless memory store on RISC-V and LoongArch
Date: Sat, 11 Mar 2023 07:00:29 +0000	[thread overview]
Message-ID: <bug-109035-4-KFpVA00cNX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109035-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109035

--- Comment #6 from chenglulu <chenglulu at loongson dot cn> ---
I tried changing the code,
diff --git a/gcc/lra-eliminations.cc b/gcc/lra-eliminations.cc
index 42206366669..efaea6922b5 100644
--- a/gcc/lra-eliminations.cc
+++ b/gcc/lra-eliminations.cc
@@ -914,6 +914,11 @@ eliminate_regs_in_insn (rtx_insn *insn, bool replace_p,
bool first_p,
       /* First see if the source is of the form (plus (...) CST).  */
       if (plus_src && poly_int_rtx_p (XEXP (plus_src, 1), &offset))
        plus_cst_src = plus_src;
+      else if (plus_src && ira_reg_equiv[REGNO (XEXP (plus_src, 1))].constant)
+       {
+         poly_int_rtx_p (ira_reg_equiv[REGNO (XEXP (plus_src, 1))].constant,
&offset);
+         plus_cst_src = gen_rtx_PLUS (GET_MODE (XEXP (plus_src, 0)),XEXP
(plus_src, 0), ira_reg_equiv[REGNO (XEXP (plus_src, 1))].constant);
+       }
       /* Check that the first operand of the PLUS is a hard reg or
         the lowpart subreg of one.  */
       if (plus_cst_src)

Redundant instructions can be eliminated, but I don't know if it can be
modified like this.

  parent reply	other threads:[~2023-03-11  7:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06  7:51 [Bug rtl-optimization/109035] New: " xry111 at gcc dot gnu.org
2023-03-06  7:52 ` [Bug rtl-optimization/109035] " xry111 at gcc dot gnu.org
2023-03-06  8:02 ` xry111 at gcc dot gnu.org
2023-03-08  3:16 ` chenglulu at loongson dot cn
2023-03-08  3:37 ` xry111 at gcc dot gnu.org
2023-03-08  3:55 ` chenglulu at loongson dot cn
2023-03-11  6:44 ` chenglulu at loongson dot cn
2023-03-11  7:00 ` chenglulu at loongson dot cn [this message]
2023-11-02 19:25 ` vmakarov at gcc dot gnu.org
2023-11-02 19:47 ` law at gcc dot gnu.org
2023-11-03  6:52 ` xry111 at gcc dot gnu.org
2023-11-03  7:46 ` xry111 at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109035-4-KFpVA00cNX@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).