[compiler-rt] 604db5f - [PGO][HIP][NFC] Fix hipModuleGetGlobal -Wunused-function warning (#207293)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 18:08:04 PDT 2026


Author: Wenju He
Date: 2026-07-03T09:07:59+08:00
New Revision: 604db5fc463d2e252c2575ff519f479c88cfe093

URL: https://github.com/llvm/llvm-project/commit/604db5fc463d2e252c2575ff519f479c88cfe093
DIFF: https://github.com/llvm/llvm-project/commit/604db5fc463d2e252c2575ff519f479c88cfe093.diff

LOG: [PGO][HIP][NFC] Fix hipModuleGetGlobal -Wunused-function warning (#207293)

The functions trigger the warning on Windows (without elf.h) and is
fatal under -Werror.
Fix by adding [[maybe_unused]]. Alternatively it could be moved inside
the existing __has_include(<elf.h>) block,; however that would trigger
-Wunused-but-set-global on pHipModuleGetGlobal.
Current fix is minimal and can be removed once hipModuleGetGlobal is
supported without elf.h.

Added: 
    

Modified: 
    compiler-rt/lib/profile/InstrProfilingPlatformROCm.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/profile/InstrProfilingPlatformROCm.cpp b/compiler-rt/lib/profile/InstrProfilingPlatformROCm.cpp
index 5667de35d3bdc..93d3cbce38de8 100644
--- a/compiler-rt/lib/profile/InstrProfilingPlatformROCm.cpp
+++ b/compiler-rt/lib/profile/InstrProfilingPlatformROCm.cpp
@@ -303,6 +303,7 @@ int __prof_rocm::memcpyDeviceToHost(void *Dst, const void *Src, size_t Size) {
   return hipMemcpy(Dst, Src, Size, 2 /* DToH */);
 }
 
+[[maybe_unused]]
 static int hipModuleGetGlobal(void **DevPtr, size_t *Bytes, void *Module,
                               const char *Name) {
   ensureHipLoaded();


        


More information about the llvm-commits mailing list