r247273 - [OPENMP] Generate threadprivates as TLS variables by default.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 05:06:58 PDT 2015


Author: abataev
Date: Thu Sep 10 07:06:58 2015
New Revision: 247273

URL: http://llvm.org/viewvc/llvm-project?rev=247273&view=rev
Log:
[OPENMP] Generate threadprivates as TLS variables by default.
If target supports TLS all threadprivates are generated as TLS. If target does not support TLS, use runtime calls for proper codegen of threadprivate variables.

Added:
    cfe/trunk/test/OpenMP/driver.c   (with props)
Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=247273&r1=247272&r2=247273&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Sep 10 07:06:58 2015
@@ -4205,10 +4205,7 @@ void Clang::ConstructJob(Compilation &C,
       // given, decide a default based on the target. Otherwise rely on the
       // options and pass the right information to the frontend.
       if (!Args.hasFlag(options::OPT_fopenmp_use_tls,
-                        options::OPT_fnoopenmp_use_tls,
-                        getToolChain().getArch() == llvm::Triple::ppc ||
-                            getToolChain().getArch() == llvm::Triple::ppc64 ||
-                            getToolChain().getArch() == llvm::Triple::ppc64le))
+                        options::OPT_fnoopenmp_use_tls, /*Default=*/true))
         CmdArgs.push_back("-fnoopenmp-use-tls");
       break;
     default:

Added: cfe/trunk/test/OpenMP/driver.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/driver.c?rev=247273&view=auto
==============================================================================
--- cfe/trunk/test/OpenMP/driver.c (added)
+++ cfe/trunk/test/OpenMP/driver.c Thu Sep 10 07:06:58 2015
@@ -0,0 +1,10 @@
+// Test that by default -fnoopenmp-use-tls is passed to frontend.
+//
+// RUN: %clang %s -### -o %t.o 2>&1 -fopenmp=libomp | FileCheck --check-prefix=CHECK-DEFAULT %s
+// CHECK-DEFAULT: -cc1
+// CHECK-DEFAULT-NOT: -fnoopenmp-use-tls
+//
+// RUN: %clang %s -### -o %t.o 2>&1 -fopenmp=libomp -fnoopenmp-use-tls | FileCheck --check-prefix=CHECK-NO-TLS %s
+// CHECK-NO-TLS: -cc1
+// CHECK-NO-TLS-SAME: -fnoopenmp-use-tls
+//

Propchange: cfe/trunk/test/OpenMP/driver.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/trunk/test/OpenMP/driver.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: cfe/trunk/test/OpenMP/driver.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the cfe-commits mailing list