[clang] Revert "[Clang][OpenMP][Driver] Make linker to link Device RTL when built for SPIRV" (PR #181876)

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 17 10:12:54 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (fineg74)

<details>
<summary>Changes</summary>

Reverts llvm/llvm-project#<!-- -->180066

---
Full diff: https://github.com/llvm/llvm-project/pull/181876.diff


2 Files Affected:

- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+1-1) 
- (modified) clang/test/Driver/openmp-offload-gpu.c (-17) 


``````````diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 1421c3b3b1ea4..c16aa33f29ebb 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9304,7 +9304,7 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
 
       // If this is OpenMP the device linker will need `-lompdevice`.
       if (Kind == Action::OFK_OpenMP && !Args.hasArg(OPT_no_offloadlib) &&
-          TC->getTriple().isGPU())
+          (TC->getTriple().isAMDGPU() || TC->getTriple().isNVPTX()))
         LinkerArgs.emplace_back("-lompdevice");
 
       // Forward all of these to the appropriate toolchain.
diff --git a/clang/test/Driver/openmp-offload-gpu.c b/clang/test/Driver/openmp-offload-gpu.c
index f12e79868fca2..fb1bc9ffdbbd4 100644
--- a/clang/test/Driver/openmp-offload-gpu.c
+++ b/clang/test/Driver/openmp-offload-gpu.c
@@ -410,20 +410,3 @@
 // RUN:   | FileCheck --check-prefix=SHOULD-EXTRACT %s
 //
 // SHOULD-EXTRACT: clang-linker-wrapper{{.*}}"--should-extract=gfx906"
-
-//
-// Check ompdevice is linked.
-//
-// RUN:   %clang -###  -fopenmp -fopenmp-targets=nvptx64 --offload-arch=sm_52 \
-// RUN:     --cuda-path=%S/Inputs/CUDA_102/usr/local/cuda \
-// RUN:     --libomptarget-nvptx-bc-path=%S/Inputs/libomptarget/libomptarget-nvptx-test.bc %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=OMPDEVICE %s
-//
-// RUN:   %clang -###  -fopenmp -fopenmp-targets=amdgcn --offload-arch=gfx908 \
-// RUN:     --rocm-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=OMPDEVICE %s
-//
-// RUN:   %clang -###  -fopenmp -fopenmp-targets=spirv64 \
-// RUN:     --libomptarget-spirv-bc-path=%S/Inputs/spirv-openmp/lib/libomptarget-spirv.bc %s 2>&1 \
-// RUN:   | FileCheck --check-prefix=OMPDEVICE %s
-// OMPDEVICE: clang-linker-wrapper{{.*}}--device-linker{{.*}}-lompdevice

``````````

</details>


https://github.com/llvm/llvm-project/pull/181876


More information about the cfe-commits mailing list