summaryrefslogtreecommitdiffstats
path: root/test/loop-convert/dependency.cpp
blob: 2f960052d2841028f364806614940125b09014cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// RUN: rm -rf %t.cpp
// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp
// RUN: loop-convert . %t.cpp -- && FileCheck -input-file=%t.cpp %s

void f() {
  const int N = 6;
  const int M = 8;
  int arr[N][M];

  for (int i = 0; i < N; ++i) {
    int a = 0;
    int b = arr[i][a];
  }
  // CHECK: for (auto & [[VAR:[a-z_]+]] : arr) {
  // CHECK-NEXT: int a = 0;
  // CHECK-NEXT: int b = [[VAR]][a];
  // CHECK-NEXT: }

  for (int j = 0; j < M; ++j) {
    int a = 0;
    int b = arr[a][j];
  }
  // CHECK: for (int j = 0; j < M; ++j) {
  // CHECK-NEXT: int a = 0;
  // CHECK-NEXT: int b = arr[a][j];
  // CHECK-NEXT: }
}