]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Fix up RTL sharing bug in aarch64_load_symref_appropriately [PR104910]
authorJakub Jelinek <jakub@redhat.com>
Wed, 16 Mar 2022 10:04:16 +0000 (11:04 +0100)
committerJakub Jelinek <jakub@redhat.com>
Tue, 29 Mar 2022 05:52:30 +0000 (07:52 +0200)
commit9c3225c8b7c7f74a53aaae6ed5b6463b55bf7a92
treeb957e5fafe05e4103a7c528412351b0abf8b2c0f
parent17de662ec26786053caab2cea34c76814352ea4d
aarch64: Fix up RTL sharing bug in aarch64_load_symref_appropriately [PR104910]

We unshare all RTL created during expansion, but when
aarch64_load_symref_appropriately is called after expansion like in the
following testcases, we use imm in both HIGH and LO_SUM operands.
If imm is some RTL that shouldn't be shared like a non-sharable CONST,
we get at least with --enable-checking=rtl a checking ICE, otherwise might
just get silently wrong code.

The following patch fixes that by copying it if it can't be shared.

2022-03-16  Jakub Jelinek  <jakub@redhat.com>

PR target/104910
* config/aarch64/aarch64.c (aarch64_load_symref_appropriately): Copy
imm rtx.

* gcc.dg/pr104910.c: New test.

(cherry picked from commit 952155629ca1a4dfe7c7b26e53d118a9b853ed4a)
gcc/config/aarch64/aarch64.c
gcc/testsuite/gcc.dg/pr104910.c [new file with mode: 0644]