[PATCH] D130096: [Clang][AMDGPU] Emit AMDGPU library control constants in clang

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 26 14:26:48 PDT 2022


yaxunl added inline comments.


================
Comment at: clang/lib/CodeGen/CodeGenAction.cpp:299-308
+      if (!LinkModules.empty() && Gen->CGM().getTriple().isAMDGCN() &&
+          !Gen->CGM().getLangOpts().GPURelocatableDeviceCode) {
+        const StringRef GVS[] = {"__oclc_daz_opt", "__oclc_unsafe_math_opt",
+                                 "__oclc_finite_only_opt",
+                                 "__oclc_correctly_rounded_sqrt32"};
+        for (StringRef Name : GVS) {
+          if (llvm::GlobalVariable *GV = getModule()->getGlobalVariable(Name))
----------------
need a test.

Probably let clang generate a bitcode containing a function using these control vars, then link the bitcode by -mlink-builtin-bitcode, then check the linkage of these control vars.


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