jhuber6 added a comment.

In D130096#3663411 <https://reviews.llvm.org/D130096#3663411>, @arsenm wrote:

> In D130096#3663398 <https://reviews.llvm.org/D130096#3663398>, @jhuber6 wrote:
>
>> In D130096#3663295 <https://reviews.llvm.org/D130096#3663295>, @yaxunl wrote:
>>
>>> There is no constant propagation for globals with weak linage, right? 
>>> Otherwise, it won't work. My concern is that there may be optimization 
>>> passes which do not respect the weak linkage and uses the incorrect default 
>>> value for OpenCL or HIP. Therefore I am not very confident to enable this 
>>> for OpenCL or HIP unless these variables have the correct value based on 
>>> the compilation options.
>>
>> Instead of `weak_odr` we could probably use add this to compiler used 
>> instead if that's an issue.
>
> the libraries get internalized as-is. Why does this need to be weak_odr?

It depends where we want to do the linking. For my purposes I'd like to be able 
to link in these libraries at link time. This allows us to link in target 
specific libraries as-needed so we can make generated code more generic until 
linking or the backend. The problem with `linkonce_odr` is that it does not 
need to emit a symbol, so it will usually be optimized out by clang. E.g. the 
following won't work because these generated globals will be optimized out 
completely before we have any library to use them.

  clang amdgpu.c -c -O3
  clang amdgpu.o <link ocml.bc>


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130096/new/

https://reviews.llvm.org/D130096

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to