1 // RUN: %clang -O1 -fno-unroll-loops -S -o - %s -emit-llvm | FileCheck %s 2 3 extern int a[16]; 4 int b = 0; 5 int foo(void) { 6 #pragma unroll 7 for (int i = 0; i < 16; ++i) 8 a[i] = b += 2; 9 return b; 10 } 11 // Check br i1 to make sure that the loop is fully unrolled 12 // CHECK-LABEL: foo 13 // CHECK-NOT: br i1 14 15 void Helper() { 16 const int *nodes[5]; 17 int num_active = 5; 18 19 while (num_active) 20 #pragma clang loop unroll(full) 21 for (int i = 0; i < 5; ++i) 22 if (nodes[i]) 23 --num_active; 24 } 25 26 // Check br i1 to make sure the loop is gone, there will still be a label branch for the infinite loop. 27 // CHECK-LABEL: Helper 28 // CHECK: br label 29 // CHECK-NOT: br i1 30 // CHECK: br label 31