On Tue, Oct 21, 2014 at 9:03 AM, Jakub Jelinek <ja...@redhat.com> wrote: > On Mon, Sep 29, 2014 at 01:08:56PM +0200, Jakub Jelinek wrote: >> I wonder if during/after reload we just couldn't look at >> ORIGINAL_REGNO of hard regs if ix86_use_pseudo_pic_reg. Or is that >> the other case, where you don't have any PIC register replacement around, >> and want to subtract something? Perhaps in that case we could just >> subtract the value of _GLOBAL_OFFSET_TABLE_ symbol if we have nothing better >> around. > > Here is a patch that implements both of these ideas. > > The number of lines like: > note: non-delegitimized UNSPEC UNSPEC_GOT (0) found in variable location > note: non-delegitimized UNSPEC UNSPEC_GOTOFF (1) found in variable location > during i686-linux bootstrap (not including regtest) went down from > 14165 to 19. > > The patch trusts that a hard reg with ORIGINAL_REGNO containing the pic > pseudo contains the _GLOBAL_OFFSET_TABLE_ value of the current shared > library (or binary), I think that is reasonable assumption. > And for ELF for the UNSPEC_GOTOFF it worse case can subtract > _GLOBAL_OFFSET_TABLE_ symbol if it doesn't know what register to subtract. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2014-10-21 Jakub Jelinek <ja...@redhat.com> > > PR target/63542 > * config/i386/i386.c (ix86_pic_register_p): Also return > true if x is a hard register with ORIGINAL_REGNO equal to > pic_offset_table_rtx pseudo REGNO. > (ix86_delegitimize_address): For ix86_use_pseudo_pic_reg () > after reload, subtract GOT_SYMBOL_NAME symbol if possible. > > * gcc.target/i386/pr63542-1.c: New test. > * gcc.target/i386/pr63542-2.c: New test. >
This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64025 -- H.J.