[PATCH] D53476: [clang-cl] Allowed -fopenmp work and link openmp library from per-runtime library directory
Peiyuan Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 22 18:52:52 PDT 2018
SquallATF updated this revision to Diff 170559.
SquallATF added a comment.
- add test
Repository:
rC Clang
https://reviews.llvm.org/D53476
Files:
include/clang/Driver/Options.td
lib/Driver/ToolChains/MSVC.cpp
test/Driver/cl-options.c
test/OpenMP/Inputs/resource_dir/x86_64-msvc-win32/lib/.keep
test/OpenMP/linking.c
Index: test/OpenMP/linking.c
===================================================================
--- test/OpenMP/linking.c
+++ test/OpenMP/linking.c
@@ -83,11 +83,12 @@
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -fopenmp=libomp -target x86_64-msvc-win32 -rtlib=platform \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: | FileCheck --check-prefix=CHECK-MSVC-LINK-64 %s
// CHECK-MSVC-LINK-64: link.exe
// CHECK-MSVC-LINK-64-SAME: -nodefaultlib:vcomp.lib
// CHECK-MSVC-LINK-64-SAME: -nodefaultlib:vcompd.lib
-// CHECK-MSVC-LINK-64-SAME: -libpath:{{.+}}/../lib
+// CHECK-MSVC-LINK-64-SAME: -libpath:{{.+[/\\]}}x86_64-msvc-win32{{/|\\\\}}lib
// CHECK-MSVC-LINK-64-SAME: -defaultlib:libomp.lib
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fopenmp-simd -target x86_64-msvc-win32 -rtlib=platform | FileCheck --check-prefix SIMD-ONLY11 %s
@@ -97,6 +98,7 @@
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -fopenmp=libiomp5 -target x86_64-msvc-win32 -rtlib=platform \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
// RUN: | FileCheck --check-prefix=CHECK-MSVC-ILINK-64 %s
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fopenmp-simd -target x86_64-msvc-win32 -rtlib=platform | FileCheck --check-prefix SIMD-ONLY11 %s
@@ -106,6 +108,6 @@
// CHECK-MSVC-ILINK-64: link.exe
// CHECK-MSVC-ILINK-64-SAME: -nodefaultlib:vcomp.lib
// CHECK-MSVC-ILINK-64-SAME: -nodefaultlib:vcompd.lib
-// CHECK-MSVC-ILINK-64-SAME: -libpath:{{.+}}/../lib
+// CHECK-MSVC-ILINK-64-SAME: -libpath:{{.+[/\\]}}x86_64-msvc-win32{{/|\\\\}}lib
// CHECK-MSVC-ILINK-64-SAME: -defaultlib:libiomp5md.lib
//
Index: test/Driver/cl-options.c
===================================================================
--- test/Driver/cl-options.c
+++ test/Driver/cl-options.c
@@ -572,6 +572,11 @@
// RUN: %clang_cl /guard:foo -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDINVALID %s
// CFGUARDINVALID: invalid value 'foo' in '/guard:'
+// RUN: %clang_cl -fopenmp -### -- %s 2>&1 | FileCheck -check-prefix=OPENMP %s
+// RUN: %clang_cl -fopenmp=libomp -### -- %s 2>&1 | FileCheck -check-prefix=OPENMP %s
+// RUN: %clang_cl -fopenmp=libiomp5 -### -- %s 2>&1 | FileCheck -check-prefix=OPENMP %s
+// OPENMP: -fopenmp
+
// Accept "core" clang options.
// (/Zs is for syntax-only, -Werror makes it fail hard on unknown options)
// RUN: %clang_cl \
@@ -611,6 +616,8 @@
// RUN: -fmerge-all-constants \
// RUN: -no-canonical-prefixes \
// RUN: -march=skylake \
+// RUN: -fopenmp \
+// RUN: -fopenmp=libomp \
// RUN: --version \
// RUN: -Werror /Zs -- %s 2>&1
Index: lib/Driver/ToolChains/MSVC.cpp
===================================================================
--- lib/Driver/ToolChains/MSVC.cpp
+++ lib/Driver/ToolChains/MSVC.cpp
@@ -422,8 +422,9 @@
options::OPT_fno_openmp, false)) {
CmdArgs.push_back("-nodefaultlib:vcomp.lib");
CmdArgs.push_back("-nodefaultlib:vcompd.lib");
- CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") +
- TC.getDriver().Dir + "/../lib"));
+ for (const auto &LibPath : TC.getLibraryPaths()) {
+ CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") + LibPath));
+ }
switch (TC.getDriver().getOpenMPRuntime(Args)) {
case Driver::OMPRT_OMP:
CmdArgs.push_back("-defaultlib:libomp.lib");
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1516,11 +1516,11 @@
def fobjc_sender_dependent_dispatch : Flag<["-"], "fobjc-sender-dependent-dispatch">, Group<f_Group>;
def fomit_frame_pointer : Flag<["-"], "fomit-frame-pointer">, Group<f_Group>;
-def fopenmp : Flag<["-"], "fopenmp">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused]>,
+def fopenmp : Flag<["-"], "fopenmp">, Group<f_Group>, Flags<[CC1Option, CoreOption, NoArgumentUnused]>,
HelpText<"Parse OpenMP pragmas and generate parallel code.">;
def fno_openmp : Flag<["-"], "fno-openmp">, Group<f_Group>, Flags<[NoArgumentUnused]>;
def fopenmp_version_EQ : Joined<["-"], "fopenmp-version=">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused]>;
-def fopenmp_EQ : Joined<["-"], "fopenmp=">, Group<f_Group>;
+def fopenmp_EQ : Joined<["-"], "fopenmp=">, Group<f_Group>, Flags<[CoreOption]>;
def fopenmp_use_tls : Flag<["-"], "fopenmp-use-tls">, Group<f_Group>,
Flags<[NoArgumentUnused, HelpHidden]>;
def fnoopenmp_use_tls : Flag<["-"], "fnoopenmp-use-tls">, Group<f_Group>,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53476.170559.patch
Type: text/x-patch
Size: 4633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181023/666a59b6/attachment.bin>
More information about the cfe-commits
mailing list