[PATCH] [OPENMP] Codegen for 'num_threads' clause in 'parallel' directive
hfinkel at anl.gov
hfinkel at anl.gov
Mon Sep 22 21:36:13 PDT 2014
================
Comment at: lib/Sema/SemaOpenMP.cpp:2592
@@ -2591,3 +2591,3 @@
Expr *ValExpr = NumThreads;
if (!NumThreads->isValueDependent() && !NumThreads->isTypeDependent() &&
!NumThreads->isInstantiationDependent() &&
----------------
ABataev wrote:
> hfinkel wrote:
> > ABataev wrote:
> > > hfinkel wrote:
> > > > Do you need all of these checks, or is value-dependent enough?
> > > I think we need all of them, because num_threads argument is not a constant, but an expression.
> > I'm not sure; I think this is worth testing. A similar issue same up with the patches for the assume_aligned attribute, and it turned out that only the ValueDependent check was needed. Note that sizeof(T), for example, is value-dependent, not type-dependent.
> Here are some excerpts from the header:
> /// template<int Size, char (&Chars)[Size]> struct meta_string - value depend bound of Chars
> /// template<typename T> void add(T x) { return x;} - x is type dependent - it can be used as num_threads(x)
> /// template<typename T> void add() { return sizeof(sizeof(T()));} - return is instantiation-dependent - I think this check can be excluded
> /// template<typename F, typename ...Types> void forward(const F &f, Types &&...args) { f(static_cast<Types&&>(args)...); } - call to f contains unexpanded parameter pack - num_threads(f(static_cast<Types&&>(args)...))
>
Ah, you're right. num_threads is not necessarily a compile-time constant, so the situation is different.
http://reviews.llvm.org/D5145
More information about the cfe-commits
mailing list