[PATCH] D10753: [OpenMP] Add TLS-based implementation for threadprivate directive
Alexey Bataev
a.bataev at hotmail.com
Thu Jul 9 21:42:14 PDT 2015
ABataev added inline comments.
================
Comment at: lib/AST/Decl.cpp:1818
@@ -1813,3 +1817,3 @@
case TSCS__Thread_local:
- return TLS_Static;
+ return hasAttr<OMPThreadPrivateDeclAttr>() ? TLS_Dynamic : TLS_Static;
case TSCS_thread_local:
----------------
thread_local variable cannot be threadprivate, restore the original code
================
Comment at: lib/Driver/Tools.cpp:3953-3971
@@ -3952,2 +3952,21 @@
CmdArgs.push_back("-fopenmp");
+
+ // If no option regarding the use of TLS in OpenMP codegeneration is
+ // given, decide a default based on the target. Otherwise rely on the
+ // options and pass the right information to the frontend.
+ if (!Args.getLastArg(options::OPT_fopenmp_use_tls) &&
+ !Args.getLastArg(options::OPT_fnoopenmp_use_tls)) {
+ switch (getToolChain().getArch()) {
+ default:
+ CmdArgs.push_back("-fnoopenmp-use-tls");
+ break;
+ case llvm::Triple::ppc:
+ case llvm::Triple::ppc64:
+ case llvm::Triple::ppc64le:
+ break;
+ }
+ } else if (!Args.hasFlag(options::OPT_fopenmp_use_tls,
+ options::OPT_fnoopenmp_use_tls,
+ /*Default=*/false))
+ CmdArgs.push_back("-fnoopenmp-use-tls");
break;
----------------
Change it to :
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))
CmdArgs.push_back("-fnoopenmp-use-tls");
http://reviews.llvm.org/D10753
More information about the cfe-commits
mailing list