On Wed, Mar 16, 2022 at 09:10:35AM +0000, Richard Sandiford wrote: > Jakub Jelinek <ja...@redhat.com> writes: > > 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. > > > > Bootstrapped/regtested on aarch64-linux, ok for trunk? > > > > 2022-03-15 Jakub Jelinek <ja...@redhat.com> > > > > PR target/104910 > > * config/aarch64/aarch64.cc (aarch64_load_symref_appropriately): Copy > > imm rtx. > > > > * gcc.dg/pr104910.c: New test. > > OK, thanks. I guess the REG_EQUAL notes might need the same treatment, > but that's probably a separate patch.
If it can be invoked after expansion, yes. Though, I think e.g. having the TLS related loads/stores done after expansion is unlikely. Anyway, --enable-checking=rtl ought to catch this. Jakub