[PATCH] D130096: [Clang][AMDGPU] Emit AMDGPU library control constants in clang
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 19 11:28:18 PDT 2022
jhuber6 marked an inline comment as done.
jhuber6 added a comment.
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.
Yes, the problem is that `linkonce_odr` can be removed and as-such isn't usable for linking libraries late like we want to. You are correct that `weak_odr` normally cannot be propagated as another TU could potentially change it, but if we're linking this via LTO like AMDGPU does it should always be internalized in the linker. The OpenMP runtime has a similar `weak_odr` variable that gets internalized when we do LTO so it should apply here as well. Although my assumption is that AMDGPU always feeds bitcode directly to either `lld` or `clang-linker-wrapper` without invoking `llc` manually, I may be wrong there.
================
Comment at: clang/lib/CodeGen/TargetInfo.cpp:9480
+ AddGlobal("__oclc_ISA_version", Minor + Major * 1000, 32);
+ AddGlobal("__oclc_ABI_version", 400, 32);
+}
----------------
yaxunl wrote:
> should be determined by the code object version option.
Yes I wasn't sure about this one. Could you elaborate where we derive that?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130096/new/
https://reviews.llvm.org/D130096
More information about the cfe-commits
mailing list