Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / declare_reduction_codegen_in_templates.cpp
blob7689cfc11f62725882f20fd1b0845d96be36376b
1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++17 -emit-llvm %s -triple x86_64-linux -fexceptions -fcxx-exceptions -o - -femit-all-decls -disable-llvm-passes | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++17 -triple x86_64-linux -fexceptions -fcxx-exceptions -emit-pch -o %t %s -femit-all-decls -disable-llvm-passes
3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-linux -fexceptions -fcxx-exceptions -std=c++17 -include-pch %t -verify %s -emit-llvm -o - -femit-all-decls -disable-llvm-passes | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -std=c++17 -emit-llvm %s -triple x86_64-linux -fexceptions -fcxx-exceptions -o - -femit-all-decls -disable-llvm-passes | FileCheck --check-prefix SIMD-ONLY0 %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++17 -triple x86_64-linux -fexceptions -fcxx-exceptions -emit-pch -o %t %s -femit-all-decls -disable-llvm-passes
7 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-linux -fexceptions -fcxx-exceptions -std=c++17 -include-pch %t -verify %s -emit-llvm -o - -femit-all-decls -disable-llvm-passes | FileCheck --check-prefix SIMD-ONLY0 %s
8 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9 // expected-no-diagnostics
11 // CHECK: call void (ptr, i32, ptr, ...) @__kmpc_fork_call(ptr @{{.+}}, i32 1, ptr [[OUTLINED:@.+]], ptr %{{.+}})
13 // CHECK: define internal void [[OUTLINED]](ptr noalias noundef %{{.+}}, ptr noalias noundef %{{.+}}, ptr {{.+}})
14 // CHECK: call i32 @__kmpc_reduce_nowait(ptr
16 #ifndef HEADER
17 #define HEADER
19 typedef long unsigned a;
20 namespace std {
21 template <class> class initializer_list {
22 const int *b;
23 a c;
25 template <typename, typename> class d {};
26 template <typename e> class f {
27 public:
28 f(initializer_list<e>);
30 } // namespace std
31 template <class g, class h> void foo(g, h) {
32 std::d<a, double> i;
33 #pragma omp declare reduction(j : std::d <a, double> : []{}())
34 #pragma omp parallel reduction(j : i)
37 void k() {
38 std::f<int> l{};
39 std::f<int> m{2};
40 foo(l, m);
43 #endif // HEADER