]> git.ipfire.org Git - thirdparty/gcc.git/commit
[PR111497][LRA]: Copy substituted equivalence
authorVladimir N. Makarov <vmakarov@redhat.com>
Mon, 25 Sep 2023 20:19:50 +0000 (16:19 -0400)
committerRichard Biener <rguenther@suse.de>
Thu, 30 Nov 2023 08:21:15 +0000 (09:21 +0100)
commit741743c028dc00f27b9c8b1d5211c1f602f2fddd
tree0dcd4e371bb44ec90eaf61ee999089683c3880e7
parent157add39f59e1c4621eb3c198e8eae298f10b4e1
[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.

(cherry picked from commit 3c23defed384cf17518ad6c817d94463a445d21b)
gcc/lra-constraints.cc
gcc/lra.cc
gcc/testsuite/g++.target/i386/pr111497.C [new file with mode: 0644]