public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Przemyslaw Wirkus <wirkus@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-9881] [PR98722] LRA: Check that target has no 3-op add insn to transform 2 plus expression. Date: Wed, 2 Jun 2021 22:26:47 +0000 (GMT) [thread overview] Message-ID: <20210602222647.BF268388E80B@sourceware.org> (raw) https://gcc.gnu.org/g:1791b11d9cae388ae18a768eeb96c998439c986a commit r10-9881-g1791b11d9cae388ae18a768eeb96c998439c986a Author: Vladimir N. Makarov <vmakarov@redhat.com> Date: Wed Jan 20 11:40:14 2021 -0500 [PR98722] LRA: Check that target has no 3-op add insn to transform 2 plus expression. Patch cf2ac1c30af0fa783c8d72e527904dda5d8cc330 for solving PR97969 was assumed for targets with absent 3-op add insn. But the original patch did not check this. This patch adds the check. gcc/ChangeLog: PR rtl-optimization/98722 * lra-eliminations.c (eliminate_regs_in_insn): Check that target has no 3-op add insn to transform insns containing two pluses. gcc/testsuite/ChangeLog: PR rtl-optimization/98722 * g++.target/s390/pr98722.C: New. (cherry picked from commit 4334b524274203125193a08a8485250c41c2daa9) Diff: --- gcc/lra-eliminations.c | 5 ++++- gcc/testsuite/g++.target/s390/pr98722.C | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gcc/lra-eliminations.c b/gcc/lra-eliminations.c index e2d4b24db2a..d9e78d44312 100644 --- a/gcc/lra-eliminations.c +++ b/gcc/lra-eliminations.c @@ -1057,7 +1057,10 @@ eliminate_regs_in_insn (rtx_insn *insn, bool replace_p, bool first_p, reg2 = SUBREG_REG (reg2); if (REG_P (reg1) && REG_P (reg2) && REGNO (reg1) < FIRST_PSEUDO_REGISTER - && REGNO (reg2) >= FIRST_PSEUDO_REGISTER) + && REGNO (reg2) >= FIRST_PSEUDO_REGISTER + && GET_MODE (reg1) == Pmode + && !have_addptr3_insn (gen_reg_rtx (Pmode), reg1, + XEXP (XEXP (SET_SRC (set), 0), 1))) { XEXP (XEXP (SET_SRC (set), 0), 0) = op2; XEXP (SET_SRC (set), 1) = op1; diff --git a/gcc/testsuite/g++.target/s390/pr98722.C b/gcc/testsuite/g++.target/s390/pr98722.C new file mode 100644 index 00000000000..64edaf3de21 --- /dev/null +++ b/gcc/testsuite/g++.target/s390/pr98722.C @@ -0,0 +1,12 @@ +// { dg-do compile } +// { dg-options "-Og -fno-tree-fre -fno-split-wide-types" } +struct B { + virtual void Method(); +}; +typedef void (B::*fn_type_a)(); + +int main() { + fn_type_a f(&B::Method); + B b; + (b.*f)(); +}
reply other threads:[~2021-06-02 22:26 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210602222647.BF268388E80B@sourceware.org \ --to=wirkus@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).