Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / openmp / runtime / test / ompt / synchronization / ordered_dependences.c
blob5b7d56599f0e1f85cfce8066a95c2e4414f23806
1 // RUN: %libomp-c99-compile-and-run | %sort-threads | FileCheck %s
2 // REQUIRES: ompt
3 // UNSUPPORTED: gcc-4, gcc-5, gcc-6, gcc-7
4 #include "callback.h"
5 #include <omp.h>
7 int main() {
8 int a[10][10];
9 #pragma omp parallel num_threads(2)
10 #pragma omp for ordered(2)
11 for (int i = 0; i < 2; i++)
12 for (int j = 0; j < 2; j++) {
13 a[i][j] = i + j + 1;
14 printf("%d, %d\n", i, j);
15 #pragma omp ordered depend(sink : i - 1, j) depend(sink : i, j - 1)
16 if (i > 0 && j > 0)
17 a[i][j] = a[i - 1][j] + a[i][j - 1] + 1;
18 printf("%d, %d\n", i, j);
19 #pragma omp ordered depend(source)
22 return 0;
24 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
26 // CHECK: {{^}}[[MASTER:[0-9]+]]: ompt_event_loop_begin:
27 // CHECK-SAME: parallel_id={{[0-9]+}}, parent_task_id=[[ITASK:[0-9]+]],
29 // CHECK: {{^}}[[MASTER]]: ompt_event_dependences: task_id=[[ITASK]],
30 // CHECK-SAME: deps=[(0, ompt_dependence_type_source), (0,
31 // CHECK-SAME: ompt_dependence_type_source)], ndeps=2
33 // CHECK: {{^}}[[MASTER]]: ompt_event_dependences: task_id=[[ITASK]],
34 // CHECK-SAME: deps=[(0, ompt_dependence_type_sink), (0,
35 // CHECK-SAME: ompt_dependence_type_sink)], ndeps=2
37 // CHECK: {{^}}[[MASTER]]: ompt_event_dependences: task_id=[[ITASK]],
38 // CHECK-SAME: deps=[(0, ompt_dependence_type_source), (1,
39 // CHECK-SAME: ompt_dependence_type_source)], ndeps=2
41 // CHECK: {{^}}[[WORKER:[0-9]+]]: ompt_event_loop_begin:
42 // CHECK-SAME: parallel_id={{[0-9]+}}, parent_task_id=[[ITASK:[0-9]+]],
44 // CHECK: {{^}}[[WORKER]]: ompt_event_dependences: task_id=[[ITASK]],
45 // CHECK-SAME: deps=[(0, ompt_dependence_type_sink), (0,
46 // CHECK-SAME: ompt_dependence_type_sink)], ndeps=2
48 // CHECK: {{^}}[[WORKER]]: ompt_event_dependences: task_id=[[ITASK]],
49 // CHECK-SAME: deps=[(1, ompt_dependence_type_source), (0,
50 // CHECK-SAME: ompt_dependence_type_source)], ndeps=2
52 // either can be first for last iteration
54 // CHECK-DAG: [[ITASK]]{{.*}}deps=[(0{{.*}}sink), (1,{{.*}}sink)]
56 // CHECK-DAG: [[ITASK]]{{.*}}deps=[(1{{.*}}sink), (0,{{.*}}sink)]
58 // CHECK: {{^}}[[WORKER]]: ompt_event_dependences: task_id=[[ITASK]],
59 // CHECK-SAME: deps=[(1, ompt_dependence_type_source), (1,
60 // CHECK-SAME: ompt_dependence_type_source)], ndeps=2