yxsamliu wrote:

> > > > An AMDGPU library function is not internalized and can be used to 
> > > > fullfill calls generated by LLVM passes or instruction selection.
> > > 
> > > 
> > > I am confused by the description of "internalized". Do you refer to LTO 
> > > internalization? You can leverage `llvm.used` to disable LTO 
> > > internalization.
> > 
> > 
> > Yes I mean LTO internalization. We want keep them to the backend but we 
> > also want to remove them if they are not used by the backend. `llvm.used` 
> > won't tell us that we can remove them since it could be specified by the 
> > users for non-amdgpu-library functions.
> 
> I wonder if we could just define another `llvm.used` similar to 
> `llvm.compiler.used` for this special case where the variable can be thrown 
> away by the backend.

we need this attribute because AMDGPU target does not support ISA level 
linking, otherwise we could just link with a library after LLVM codegen. I 
doubt this attribute is generic enough to introduce something like llvm.used. 
Also, we do not need to prevent linker from discarding the symbol, therefore it 
is unnecessary to put them in some global variables. A simple function 
attribute is suffice.

https://github.com/llvm/llvm-project/pull/74737
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to