1 // RUN: %clang_cc1 -emit-llvm -o - %s -triple x86_64-linux | FileCheck %s
15 // PR49585: Ensure that 'continue' performs the proper cleanups in the presence
16 // of a for loop condition variable.
18 // CHECK: define {{.*}} void @_Z7PR49585v(
21 // CHECK: call void @_Z1fi(i32 noundef 1)
22 // CHECK: br label %[[for_cond:.*]]
25 // CHECK: [[for_cond]]:
26 // CHECK: call {{.*}} @_Z4makev(
27 // CHECK: call {{.*}} @_ZN1AcvbEv(
28 // CHECK: br i1 {{.*}}, label %[[for_body:.*]], label %[[for_cond_cleanup:.*]]
31 // CHECK: [[for_cond_cleanup]]:
33 // CHECK: br label %[[cleanup:.*]]
36 // CHECK: [[for_body]]:
37 // CHECK: call {{.*}} @_Z4condv(
38 // CHECK: br i1 {{.*}}, label %[[if_then:.*]], label %[[if_end:.*]]
40 // CHECK: [[if_then]]:
41 // CHECK: call {{.*}} @_Z1fi(i32 noundef 3)
42 // CHECK: br label %[[for_inc:.*]]
48 // CHECK: call {{.*}} @_Z1fi(i32 noundef 4)
49 // CHECK: br label %[[for_inc]]
53 // CHECK: [[for_inc]]:
54 // CHECK: call void @_Z1fi(i32 noundef 2)
56 // CHECK: br label %[[cleanup]]
58 // CHECK: [[cleanup]]:
59 // CHECK: call void @_ZN1AD1Ev(
61 // CHECK: switch {{.*}} label
62 // CHECK-NEXT: label %[[cleanup_cont:.*]]
63 // CHECK-NEXT: label %[[for_end:.*]]
65 // CHECK: [[cleanup_cont]]:
66 // CHECK: br label %[[for_cond]]
72 // CHECK: define {{.*}} void @_Z13PR49585_breakv(
73 void PR49585_break() {
75 // CHECK: call void @_Z1fi(i32 noundef 1)
76 // CHECK: br label %[[for_cond:.*]]
79 // CHECK: [[for_cond]]:
80 // CHECK: call {{.*}} @_Z4makev(
81 // CHECK: call {{.*}} @_ZN1AcvbEv(
82 // CHECK: br i1 {{.*}}, label %[[for_body:.*]], label %[[for_cond_cleanup:.*]]
85 // CHECK: [[for_cond_cleanup]]:
87 // CHECK: br label %[[cleanup:.*]]
90 // CHECK: [[for_body]]:
91 // CHECK: call {{.*}} @_Z4condv(
92 // CHECK: br i1 {{.*}}, label %[[if_then:.*]], label %[[if_end:.*]]
94 // CHECK: [[if_then]]:
95 // CHECK: call {{.*}} @_Z1fi(i32 noundef 3)
97 // CHECK: br label %[[cleanup:.*]]
102 // CHECK: [[if_end]]:
103 // CHECK: call {{.*}} @_Z1fi(i32 noundef 4)
104 // CHECK: br label %[[for_inc]]
108 // CHECK: [[for_inc]]:
109 // CHECK: call void @_Z1fi(i32 noundef 2)
111 // CHECK: br label %[[cleanup]]
113 // CHECK: [[cleanup]]:
114 // CHECK: call void @_ZN1AD1Ev(
116 // CHECK: switch {{.*}} label
117 // CHECK-NEXT: label %[[cleanup_cont:.*]]
118 // CHECK-NEXT: label %[[for_end:.*]]
120 // CHECK: [[cleanup_cont]]:
121 // CHECK: br label %[[for_cond]]
123 // CHECK [[for_end]]:
127 // CHECK: define {{.*}} void @_Z16incless_for_loopv(
128 void incless_for_loop() {
129 // CHECK: br label %[[for_cond:.*]]
130 // CHECK: [[for_cond]]:
131 // CHECK: br i1 {{.*}}, label %[[for_body:.*]], label %[[for_end:.*]]
132 // CHECK: [[for_body]]:
133 // CHECK: br label %[[for_cond]]
134 // CHECK: [[for_end]]:
137 for (; int b
= 0;) continue;