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

--- Comment #22 from Thomas Schwinge <tschwinge at gcc dot gnu.org> ---
Context of the following (sub-)task: nvptx is '!TARGET_SUPPORTS_ALIASES', but
the host usually is 'TARGET_SUPPORTS_ALIASES', and therefore invokes the
'gcc/cp/optimize.cc:can_alias_cdtor' optimization, so we get symbol aliases in
the offloading code stream -- and then fail in the nvptx back end for
offloading compilation.  Now there was this idea:

(In reply to Richard Biener from comment #10)
> So what I'd probably try to do is assume TARGET_SUPPORTS_ALIASES early and 
> "undo" that at IPA transform time by duplicating bodies (or emitting thunks).

I'm looking into that.  I found
'gcc/cgraphunit.cc:cgraph_node::create_wrapper',
'gcc/symtab-thunks.cc:expand_thunk', and (for a start) tried copy'n'adapting
some of that code for use in nvptx 'ASM_OUTPUT_DEF_FROM_DECLS'.  It's
(slowly...) getting into a state that might work, but is way more complicated
than I think it should be.  How would you approach doing this "at IPA transform
time"?

We "simply" need to transform any symbol aliases into thunks calling the
aliasee (or duplicate the bodies, if we must).

Reply via email to