xref: /llvm-project/clang/test/CodeGen/dostmt.c (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
2 
3 int bar(void);
test0(void)4 int test0(void) {
5   int i;
6   i = 1 + 2;
7   do {
8     i = bar();
9     i = bar();
10   } while(0);
11   return i;
12 }
13 
14 
test1(void)15 int test1(void) {
16   int i;
17   i = 1 + 2;
18   do {
19     i = bar();
20     if (i == 42)
21       break;
22     i = bar();
23   } while(1);
24   return i;
25 }
26 
27 
test2(void)28 int test2(void) {
29   int i;
30   i = 1 + 2;
31   do {
32     i = bar();
33     if (i == 42)
34       continue;
35     i = bar();
36   } while(1);
37   return i;
38 }
39 
40 
test3(void)41 int test3(void) {
42   int i;
43   i = 1 + 2;
44   do {
45     i = bar();
46     if (i == 42)
47       break;
48   } while(0);
49   return i;
50 }
51 
52 
test4(void)53 int test4(void) {
54   int i;
55   i = 1 + 2;
56   do {
57     i = bar();
58     if (i == 42)
59       continue;
60   } while(0);
61   return i;
62 }
63 
test5(void)64 void test5(void) {
65   do { break; } while(0);
66 }
67 
68 // PR14191
69 void test6f(void);
test6(void)70 void test6(void) {
71   do {
72   } while (test6f(), 0);
73   // CHECK: call {{.*}}void @test6f()
74 }
75 
76