https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64412

--- Comment #17 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to H.J. Lu from comment #16)
> > > This is generated in the backend:
> > 
> > Yes, but the question is, why somehow similar testcase legitimizes the
> > address correctly with -fpic, while the original testcase doesn't.
> 
> My impressions are most of PIC addresses like:
> 
>     6: r92:DI=[const(unspec[`G'] 2)]
>     7: r91:DI=r92:DI
>       REG_EQUAL `G'
>     8: {r90:DI=r89:DI+r91:DI;clobber flags:CC;}
> 
> is generated by x86 backend vi ix86_expand_move and x86 backend was never
> presented with other opportunities before.  X86 backend isn't prepared to
> handle some RTL expansions from offload.

The x86 backend did survive many years just fine, so I think offload should be
fixed to follow approach that generic middle-end takes. The testcase I posted
expands without problems; in this case middle-end knows that symbol address has
to be moved to a register. It looks like offload bypasses generic expansion
functions (that would magically fix this issue).

Reply via email to