public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Vladimir Makarov <vmakarov@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-9644] [PR96264] LRA: Check output insn hard regs when updating available rematerialization after the insn Date: Wed, 31 Mar 2021 16:53:22 +0000 (GMT) [thread overview] Message-ID: <20210331165322.731553857C74@sourceware.org> (raw) https://gcc.gnu.org/g:1b7c97f25b271f826958873bda4fafc4cfc5b60d commit r10-9644-g1b7c97f25b271f826958873bda4fafc4cfc5b60d Author: Vladimir N. Makarov <vmakarov@redhat.com> Date: Thu Feb 18 17:49:26 2021 -0500 [PR96264] LRA: Check output insn hard regs when updating available rematerialization after the insn Insn for rematerialization can contain a clobbered hard register. We can not move such insn through another insn setting up the same hard register. The patch adds such check. gcc/ChangeLog: PR rtl-optimization/96264 * lra-remat.c (reg_overlap_for_remat_p): Check also output insn hard regs. gcc/testsuite/ChangeLog: PR rtl-optimization/96264 * gcc.target/powerpc/pr96264.c: New. Diff: --- gcc/lra-remat.c | 13 +++++++++---- gcc/testsuite/gcc.target/powerpc/pr96264.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/gcc/lra-remat.c b/gcc/lra-remat.c index 72309e52694..09c3975bc6c 100644 --- a/gcc/lra-remat.c +++ b/gcc/lra-remat.c @@ -651,7 +651,11 @@ calculate_local_reg_remat_bb_data (void) \f -/* Return true if REG overlaps an input operand of INSN. */ +/* Return true if REG overlaps an input operand or non-input hard register of + INSN. Basically the function returns false if we can move rematerialization + candidate INSN through another insn with output REG or dead input REG (we + consider it to avoid extending reg live range) with possible output pseudo + renaming in INSN. */ static bool reg_overlap_for_remat_p (lra_insn_reg *reg, rtx_insn *insn) { @@ -675,10 +679,11 @@ reg_overlap_for_remat_p (lra_insn_reg *reg, rtx_insn *insn) reg2 != NULL; reg2 = reg2->next) { - if (reg2->type != OP_IN) - continue; - unsigned regno2 = reg2->regno; int nregs2; + unsigned regno2 = reg2->regno; + + if (reg2->type != OP_IN && regno2 >= FIRST_PSEUDO_REGISTER) + continue; if (regno2 >= FIRST_PSEUDO_REGISTER && reg_renumber[regno2] >= 0) regno2 = reg_renumber[regno2]; diff --git a/gcc/testsuite/gcc.target/powerpc/pr96264.c b/gcc/testsuite/gcc.target/powerpc/pr96264.c new file mode 100644 index 00000000000..e89979b8998 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr96264.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-Os -fno-forward-propagate -fschedule-insns -fno-tree-ter -Wno-psabi" } */ +/* { dg-require-effective-target p8vector_hw } */ + +typedef unsigned char __attribute__ ((__vector_size__ (64))) v512u8; +typedef unsigned short u16; +typedef unsigned short __attribute__ ((__vector_size__ (64))) v512u16; +typedef unsigned __int128 __attribute__ ((__vector_size__ (64))) v512u128; + +v512u16 d; +v512u128 f; + +v512u8 +foo (u16 e) +{ + v512u128 g = f - -e; + d = (5 / (d + 1)) < e; + return (v512u8) g; +} + +int +main (void) +{ + v512u8 x = foo (2); + for (unsigned i = 0; i < sizeof (x); i++) + if (x[i] != (i % 16 ? 0 : 2)) + __builtin_abort (); +}
reply other threads:[~2021-03-31 16:53 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=20210331165322.731553857C74@sourceware.org \ --to=vmakarov@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).