[PATCH] D29651: [OpenMP] Consider LIBRARY_PATH when selecting library paths for NVPTX targets in OpenMP mode.

Gheorghe-Teodor Bercea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 27 15:40:15 PDT 2017


gtbercea updated this revision to Diff 93188.
gtbercea added a comment.
Herald added a subscriber: rengolin.

Update patch to reflect latest source code changes.


Repository:
  rL LLVM

https://reviews.llvm.org/D29651

Files:
  lib/Driver/ToolChains/Cuda.cpp
  test/Driver/openmp-offload.c


Index: test/Driver/openmp-offload.c
===================================================================
--- test/Driver/openmp-offload.c
+++ test/Driver/openmp-offload.c
@@ -615,3 +615,12 @@
 // CHK-FOPENMP-IS-DEVICE: clang{{.*}}.i" {{.*}}" "-fopenmp-is-device"
 // CHK-FOPENMP-IS-DEVICE-NEXT: clang{{.*}}.bc" {{.*}}.i" "-fopenmp-is-device" "-fopenmp-host-ir-file-path"
 // CHK-FOPENMP-IS-DEVICE-NEXT: clang{{.*}}.s" {{.*}}.bc" "-fopenmp-is-device"
+
+/// ###########################################################################
+
+/// Check that the lib folder pointed to by the LIBRARY_PATH is correctly passsed to the loader script.
+// RUN:   LIBRARY_PATH=/a/b/c/lib %clang -### -fopenmp=libomp -fopenmp-targets=powerpc64le-ibm-linux-gnu -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHK-LIB-PATH %s
+
+// CHK-LIB-PATH: ld{{.*}}.o" "-L/a/b/c/lib"
+// CHK-LIB-PATH: ld{{.*}}.o" "-L/a/b/c/lib"
Index: lib/Driver/ToolChains/Cuda.cpp
===================================================================
--- lib/Driver/ToolChains/Cuda.cpp
+++ lib/Driver/ToolChains/Cuda.cpp
@@ -401,6 +401,19 @@
   // came with CUDA-7.0.
   CC1Args.push_back("-target-feature");
   CC1Args.push_back("+ptx42");
+
+  if (DeviceOffloadingKind == Action::OFK_OpenMP) {
+    SmallVector<std::string, 8> LibraryPaths;
+    if (char *Env = ::getenv("LIBRARY_PATH")) {
+      StringRef CompilerPath = Env;
+      while (!CompilerPath.empty()) {
+        std::pair<StringRef, StringRef> Split =
+            CompilerPath.split(llvm::sys::EnvPathSeparator);
+        LibraryPaths.push_back(Split.first);
+        CompilerPath = Split.second;
+      }
+    }
+  }
 }
 
 void CudaToolChain::AddCudaIncludeArgs(const ArgList &DriverArgs,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29651.93188.patch
Type: text/x-patch
Size: 1746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170327/105fbc90/attachment.bin>


More information about the cfe-commits mailing list