forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitch_stmt.js
36 lines (33 loc) · 984 Bytes
/
switch_stmt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
// RUN: %hermes -O -dump-ir %s | %FileCheck %s
function backwards_branch() {
for (var i = 0; i < 4; i++) {
switch (i) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
break;
}
i = 2;
}
}
// CHECK-LABEL: function backwards_branch() : undefined
// CHECK-NEXT: frame = []
// CHECK-NEXT: %BB0:
// CHECK-NEXT: %0 = BranchInst %BB1
// CHECK-NEXT: %BB1:
// CHECK-NEXT: %1 = PhiInst 0 : number, %BB0, 3 : number, %BB1
// CHECK-NEXT: %2 = SwitchInst %1 : number, %BB1, 0 : number, %BB1, 1 : number, %BB1, 2 : number, %BB1, 3 : number, %BB1, 4 : number, %BB1, 5 : number, %BB1, 6 : number, %BB1, 7 : number, %BB1, 8 : number, %BB1, 9 : number, %BB1
// CHECK-NEXT: function_end