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 r11-9154] [PR102627] Use at least natural mode during splitting hard reg live range Date: Thu, 14 Oct 2021 16:11:50 +0000 (GMT) [thread overview] Message-ID: <20211014161150.4CED23858C3A@sourceware.org> (raw) https://gcc.gnu.org/g:99d21577f8a00196f3133fe1066de6e3e7d180c1 commit r11-9154-g99d21577f8a00196f3133fe1066de6e3e7d180c1 Author: Vladimir N. Makarov <vmakarov@redhat.com> Date: Fri Oct 8 10:16:09 2021 -0400 [PR102627] Use at least natural mode during splitting hard reg live range In the PR test case SImode was used to split live range of cx on x86-64 because it was the biggest mode for this hard reg in the function. But all 64-bits of cx contain structure members. We need always to use at least natural mode of hard reg in splitting to fix this problem. gcc/ChangeLog: PR rtl-optimization/102627 * lra-constraints.c (split_reg): Use at least natural mode of hard reg. gcc/testsuite/ChangeLog: PR rtl-optimization/102627 * gcc.target/i386/pr102627.c: New test. Diff: --- gcc/lra-constraints.c | 5 ++-- gcc/testsuite/gcc.target/i386/pr102627.c | 41 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 5c2a2d7ce9c..aaacc4eabed 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -5805,11 +5805,12 @@ split_reg (bool before_p, int original_regno, rtx_insn *insn, part of a multi-word register. In that case, just use the reg_rtx mode. Do the same also if the biggest mode was larger than a register or we can not compare the modes. Otherwise, limit the size to that of - the biggest access in the function. */ + the biggest access in the function or to the natural mode at least. */ if (mode == VOIDmode || !ordered_p (GET_MODE_PRECISION (mode), GET_MODE_PRECISION (reg_rtx_mode)) - || paradoxical_subreg_p (mode, reg_rtx_mode)) + || paradoxical_subreg_p (mode, reg_rtx_mode) + || maybe_gt (GET_MODE_PRECISION (reg_rtx_mode), GET_MODE_PRECISION (mode))) { original_reg = regno_reg_rtx[hard_regno]; mode = reg_rtx_mode; diff --git a/gcc/testsuite/gcc.target/i386/pr102627.c b/gcc/testsuite/gcc.target/i386/pr102627.c new file mode 100644 index 00000000000..8ab9acaf002 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr102627.c @@ -0,0 +1,41 @@ +/* PR rtl-optimization/102627 */ +/* { dg-do run } */ +/* { dg-options "-O1" } */ + +int a, f, l, m, q, c, d, g; +long b, e; +struct g { + signed h; + signed i; + unsigned j; + unsigned k; +}; +unsigned n; +char o; +int *p = &m; +long r(int s) { return s && b ?: b; } +long __attribute__((noipa)) v() { + l = 0 || r(n & o); + return q; +} +void w(int, unsigned, struct g x) { + c ?: a; + for (; d < 2; d++) + *p = x.k; +} +struct g __attribute__((noipa)) y() { + struct g h = {3, 908, 1, 20}; + for (; g; g++) + ; + return h; +} +int main() { + long t; + struct g u = y(); + t = e << f; + w(0, t, u); + v(0, 4, 4, 4); + if (m != 20) + __builtin_abort (); + return 0; +}
reply other threads:[~2021-10-14 16:11 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=20211014161150.4CED23858C3A@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).