r325391 - [OPENMP] Do not emit messages for templates in declare target

Jonas Hahnfeld via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 17 00:32:11 PST 2018


Hi Alexey,

I think that's mostly my test case from PR35348?

Am 2018-02-16 22:23, schrieb Alexey Bataev via cfe-commits:
> Author: abataev
> Date: Fri Feb 16 13:23:23 2018
> New Revision: 325391
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=325391&view=rev
> Log:
> [OPENMP] Do not emit messages for templates in declare target
> constructs.
> 
> The compiler may emit some extra warnings for functions, that are
> implicit specialization of the templates, declared in the target 
> region.
> 
> Modified:
>     cfe/trunk/lib/Sema/SemaOpenMP.cpp
>     cfe/trunk/test/OpenMP/declare_target_messages.cpp
> 
> [...]
> 
> Modified: cfe/trunk/test/OpenMP/declare_target_messages.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_target_messages.cpp?rev=325391&r1=325390&r2=325391&view=diff
> ==============================================================================
> --- cfe/trunk/test/OpenMP/declare_target_messages.cpp (original)
> +++ cfe/trunk/test/OpenMP/declare_target_messages.cpp Fri Feb 16 
> 13:23:23 2018
> @@ -33,6 +33,33 @@ struct NonT {
> 
>  typedef int sint;
> 
> +template <typename T>
> +T bla1() { return 0; }
> +
> +#pragma omp declare target
> +template <typename T>
> +T bla2() { return 0; }
> +#pragma omp end declare target
> +
> +template<>
> +float bla2() { return 1.0; }
> +
> +#pragma omp declare target
> +void blub2() {
> +  bla2<float>();

I don't agree with this: The compiler has to warn about calling an 
explicit template specialization that is outside of any 'declare target' 
region. That's at least the case for OpenMP 4.5, I know that there are 
changes for OpenMP 5.0. But in that case the compiler needs to add an 
implicit 'declare target' attribute to generate correct code.


More information about the cfe-commits mailing list