From: Vladimir Makarov <vmakarov@redhat.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [committed] [PR103074] LRA: Check new conflicts when splitting hard reg live range
Date: Thu, 10 Mar 2022 16:21:00 -0500 [thread overview]
Message-ID: <d27881fe-104e-68da-f5bf-7b095f3f2c6e@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 156 bytes --]
The following patch solves
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103074
The patch was successfully bootstrapped and tested on x86-64 and aarch64.
[-- Attachment #2: pr103074.patch --]
[-- Type: text/x-patch, Size: 2581 bytes --]
commit d8e5fff6b74b82c2ac3254be9a1f0fb6b30dbdbf
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date: Thu Mar 10 16:16:00 2022 -0500
[PR103074] LRA: Check new conflicts when splitting hard reg live range.
Splitting hard register live range can create (artificial)
conflict of the hard register with another pseudo because of simplified
conflict calculation in LRA. We should check such conflict on the next
assignment sub-pass and spill and reassign the pseudo if necessary.
The patch implements this.
gcc/ChangeLog:
PR target/103074
* lra-constraints.cc (split_reg): Set up
check_and_force_assignment_correctness_p when splitting hard
register live range.
gcc/testsuite/ChangeLog:
PR target/103074
* gcc.target/i386/pr103074.c: New.
diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index 080b44ad87a..d92ab76908c 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -5994,12 +5994,17 @@ split_reg (bool before_p, int original_regno, rtx_insn *insn,
before_p ? NULL : save,
call_save_p
? "Add save<-reg" : "Add split<-reg");
- if (nregs > 1)
+ if (nregs > 1 || original_regno < FIRST_PSEUDO_REGISTER)
/* If we are trying to split multi-register. We should check
conflicts on the next assignment sub-pass. IRA can allocate on
sub-register levels, LRA do this on pseudos level right now and
this discrepancy may create allocation conflicts after
- splitting. */
+ splitting.
+
+ If we are trying to split hard register we should also check conflicts
+ as such splitting can create artificial conflict of the hard register
+ with another pseudo because of simplified conflict calculation in
+ LRA. */
check_and_force_assignment_correctness_p = true;
if (lra_dump_file != NULL)
fprintf (lra_dump_file,
diff --git a/gcc/testsuite/gcc.target/i386/pr103074.c b/gcc/testsuite/gcc.target/i386/pr103074.c
new file mode 100644
index 00000000000..276ad82a1de
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr103074.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-march=bonnell -Os -fPIC -fschedule-insns -w" } */
+
+void
+serialize_collection (char *ptr, int a, int need_owner)
+{
+ if (need_owner)
+ __builtin_sprintf(ptr, "%d:%d", 0, a);
+ else
+ {
+ static char buff[32];
+
+ __builtin_sprintf(buff, "%d:%d", a >> 32, a);
+ __builtin_sprintf(ptr, "%d:%d:\"%s\"", 0, 0, buff);
+ }
+}
reply other threads:[~2022-03-10 21:21 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=d27881fe-104e-68da-f5bf-7b095f3f2c6e@redhat.com \
--to=vmakarov@redhat.com \
--cc=gcc-patches@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).