[PATCH] [OPENMP] Added option -fopenmp=libiomp5

Alexey Bataev a.bataev at hotmail.com
Thu Feb 27 03:58:10 PST 2014



================
Comment at: lib/Driver/Tools.cpp:5237-5240
@@ -5236,4 +5236,6 @@
 
-  if (Args.hasArg(options::OPT_fopenmp))
+  if (Args.hasArg(options::OPT_fopenmp)) {
     // This is more complicated in gcc...
     CmdArgs.push_back("-lgomp");
+  } else if (const Arg *A = Args.getLastArg(options::OPT_fopenmp_EQ)) {
+    if (StringRef(A->getValue()) == "libiomp5")
----------------
Dmitri Gribenko wrote:
> What happens if the user passes -fopenmp -fopenmp=libiomp5?
Then only -fopenmp will work and the warning for -fopenmp=libiomp5 will be emitted. I thought that we have to be conservative with -fopenmp option.

================
Comment at: test/OpenMP/parallel_ast_print.cpp:3
@@ -2,3 +2,3 @@
 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
+// RUN: %clang_cc1 -fopenmp=libiomp5 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
 // expected-no-diagnostics
----------------
Dmitri Gribenko wrote:
> If this flag only changes the linker option, then there is no need to update AST tests with it.
No, it also turns on OpenMP support in front end. You can consider -fopenmp=libiomp5 option as an extension for -fopenmp option. My idea was not only link libiomp5, but also generate the IR for libiomp5 runtime only if -fopenmp=libiomp5 is specified. If -fopenmp is specified, the IR won't be generated (for compatibility).


http://llvm-reviews.chandlerc.com/D2841



More information about the cfe-commits mailing list