[clang] [HIP] Do not include the CUID module hash with the new driver (PR #84332)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 7 07:26:10 PST 2024


https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/84332

Summary:
The new driver does not need this hash and it can lead to redefined
symbol errors when the CUID hash isn't set.


>From 012ead550448376f4fefd9fb70418e32f02dba6b Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Thu, 7 Mar 2024 09:25:00 -0600
Subject: [PATCH] [HIP] Do not include the CUID module hash with the new driver

Summary:
The new driver does not need this hash and it can lead to redefined
symbol errors when the CUID hash isn't set.
---
 clang/lib/CodeGen/CodeGenModule.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index d02875c6a86d77..967319bdfc4571 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -916,7 +916,7 @@ void CodeGenModule::Release() {
         llvm::ConstantArray::get(ATy, UsedArray), "__clang_gpu_used_external");
     addCompilerUsedGlobal(GV);
   }
-  if (LangOpts.HIP) {
+  if (LangOpts.HIP && !getLangOpts().OffloadingNewDriver) {
     // Emit a unique ID so that host and device binaries from the same
     // compilation unit can be associated.
     auto *GV = new llvm::GlobalVariable(



More information about the cfe-commits mailing list