Skip to content

Commit e37e2c9

Browse files
committed
[CIR] Remove XFAIL and add new tests for unreachable_after_{break,return}
1 parent fff5b8d commit e37e2c9

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed
Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,49 @@
11
// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o %t.cir
22
// RUN: FileCheck --input-file=%t.cir %s
3-
// XFAIL: *
43

4+
// CHECK: _Z23unreachable_after_breaki
55
void unreachable_after_break(int a) {
66
switch(a) {
77
case 0:
88
break;
99
break;
1010
int x = 1;
1111
}
12+
// cir.switch
13+
// cir.case(equal, [#cir.int<0> : !s32i]) {
14+
// cir.break
15+
// ^bb{{.*}}: // no predecessors
16+
// cir.break
17+
// ^bb{{.*}}: // no predecessors
18+
// %[[CONST:.*]] = cir.const #cir.int<1> : !s32i
19+
// cir.store align(4) {{.*}}, %[[CONST]]
20+
// cir.yield
1221
}
1322

23+
// CHECK: _Z24unreachable_after_returni
1424
int unreachable_after_return(int a) {
1525
switch (a) {
1626
case 0:
1727
return 0;
1828
return 1;
19-
int x = 1;
29+
int x = 3;
2030
}
2131
return 2;
32+
// cir.switch
33+
// cir.case(equal, [#cir.int<0> : !s32i]) {
34+
// %[[CONST_ZERO:.*]] = cir.const #cir.int<0> : !s32i
35+
// cir.store {{.*}}, %[[CONST_ZERO]]
36+
// cir.br ^bb1
37+
// ^bb1: // 2 preds: ^bb0, ^bb2
38+
// cir.load
39+
// cir.return
40+
// ^bb2: // no predecessors
41+
// %[[CONST_ONE:.*]] = cir.const #cir.int<1> : !s32i
42+
// cir.store %[[CONST_ONE]]
43+
// cir.br ^bb1
44+
// ^bb3: // no predecessors
45+
// %[[CONST_THREE:.*]] = cir.const #cir.int<3> : !s32i
46+
// cir.store align(4) %[[CONST_THREE]]
47+
// cir.yield
48+
// }
2249
}

0 commit comments

Comments
 (0)