]> granicus.if.org Git - clang/commitdiff
[OPENMP] Generate threadprivates as TLS variables by default.
authorAlexey Bataev <a.bataev@hotmail.com>
Thu, 10 Sep 2015 12:06:58 +0000 (12:06 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Thu, 10 Sep 2015 12:06:58 +0000 (12:06 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@247273 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/OpenMP/driver.c [new file with mode: 0644]

index d9fa2e2e4b8b76dbaea85ae8eb178993c1512e01..eca599297b6621ce458ab9fc3fcfe385f2fe1b96 100644 (file)
@@ -4205,10 +4205,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
       // 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:
diff --git a/test/OpenMP/driver.c b/test/OpenMP/driver.c
new file mode 100644 (file)
index 0000000..f84541b
--- /dev/null
@@ -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
+//