aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra.cc
diff options
context:
space:
mode:
authorVladimir N. Makarov <vmakarov@redhat.com>2023-09-25 16:19:50 -0400
committerVladimir N. Makarov <vmakarov@redhat.com>2023-09-25 16:20:09 -0400
commit3c23defed384cf17518ad6c817d94463a445d21b (patch)
treeb777ee78775055a3fe170d9ffc09403f82d2b6ba /gcc/lra.cc
parent19df06f67c982b4e5427c4a056319d6a51c03481 (diff)
downloadgcc-3c23defed384cf17518ad6c817d94463a445d21b.zip
gcc-3c23defed384cf17518ad6c817d94463a445d21b.tar.gz
gcc-3c23defed384cf17518ad6c817d94463a445d21b.tar.bz2
[PR111497][LRA]: Copy substituted equivalence
When we substitute the equivalence and it becomes shared, we can fail to correctly update reg info used by LRA. This can result in wrong code generation, e.g. because of incorrect live analysis. It can also result in compiler crash as the pseudo survives RA. This is what exactly happened for the PR. This patch solves this problem by unsharing substituted equivalences. gcc/ChangeLog: PR middle-end/111497 * lra-constraints.cc (lra_constraints): Copy substituted equivalence. * lra.cc (lra): Change comment for calling unshare_all_rtl_again. gcc/testsuite/ChangeLog: PR middle-end/111497 * g++.target/i386/pr111497.C: new test.
Diffstat (limited to 'gcc/lra.cc')
-rw-r--r--gcc/lra.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/gcc/lra.cc b/gcc/lra.cc
index 563aff1..361f84f 100644
--- a/gcc/lra.cc
+++ b/gcc/lra.cc
@@ -2579,9 +2579,8 @@ lra (FILE *f)
if (inserted_p)
commit_edge_insertions ();
- /* Replacing pseudos with their memory equivalents might have
- created shared rtx. Subsequent passes would get confused
- by this, so unshare everything here. */
+ /* Subsequent passes expect that rtl is unshared, so unshare everything
+ here. */
unshare_all_rtl_again (get_insns ());
if (flag_checking)