Clang Project

clang_source_code/test/CodeGenCXX/pragma-loop-distribute.cpp
1// RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm -o - %s | FileCheck %s
2
3void while_test(int *List, int Length, int *List2, int Length2) {
4  // CHECK: define {{.*}} @_Z10while_test
5  int i = 0;
6
7#pragma clang loop distribute(enable)
8  while (i < Length) {
9    // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_1:.*]]
10    List[i] = i * 2;
11    i++;
12  }
13
14  i = 0;
15  while (i < Length2) {
16    // CHECK-NOT: br label {{.*}}, !llvm.loop
17    List2[i] = i * 2;
18    i++;
19  }
20}
21
22// CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[DISTRIBUTE_ENABLE:.*]]}
23// CHECK: ![[DISTRIBUTE_ENABLE]] = !{!"llvm.loop.distribute.enable", i1 true}
24