Index: lib/CodeGen/CodeGenModule.cpp =================================================================== --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -438,6 +438,7 @@ SanStats->finish(); if (CodeGenOpts.Autolink && + !(Context.getLangOpts().CUDAIsDevice && Context.getLangOpts().HIP) && (Context.getLangOpts().Modules || !LinkerOptionsMetadata.empty())) { EmitModuleLinkOptions(); } Index: test/CodeGenCUDA/linker-options.cu =================================================================== --- /dev/null +++ test/CodeGenCUDA/linker-options.cu @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -emit-llvm -o - -fcuda-is-device -x hip %s | FileCheck %s + +// CHECK-NOT: llvm.linker.options +#pragma comment(lib, "a.so")