| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import 'opt_redundant_phi_test.dart'; | |
| 6 | |
| 7 // The 'cyclic deps' IR tests removal of redundant phis with cyclic | |
| 8 // dependencies. | |
| 9 // | |
| 10 // void main() { | |
| 11 // var x = 0; | |
| 12 // var y = x; | |
| 13 // for (int i = 0; i < 10; i++) { | |
| 14 // if (i == -1) x = y; | |
| 15 // if (i == -1) y = x; | |
| 16 // } | |
| 17 // print(x); | |
| 18 // print(y); | |
| 19 // } | |
| 20 | |
| 21 String CYCLIC_DEPS_IN = """ | |
| 22 (FunctionDefinition main (return) (LetPrim v0 (Constant 0)) | |
| 23 (LetPrim v1 (Constant 0)) | |
| 24 (LetCont* (k0 v2 v3 v4) | |
| 25 (LetCont (k1) | |
| 26 (LetCont (k2 v5) | |
| 27 (LetCont (k3 v6) (LetPrim v7 (Constant null)) | |
| 28 (InvokeContinuation return v7)) | |
| 29 (InvokeStatic print v3 k3)) | |
| 30 (InvokeStatic print v2 k2)) | |
| 31 (LetCont (k4) (LetPrim v8 (Constant 1)) | |
| 32 (LetCont (k5 v9) | |
| 33 (LetCont (k6 v10) | |
| 34 (LetCont (k7 v11) (LetPrim v12 (Constant 1)) | |
| 35 (LetCont (k8 v13) | |
| 36 (LetCont (k9 v14) | |
| 37 (LetCont (k10 v15) | |
| 38 (LetPrim v16 (Constant 1)) | |
| 39 (LetCont (k11 v17) | |
| 40 (InvokeContinuation* k0 v11 v15 v17)) | |
| 41 (InvokeMethod v4 + v16 k11)) | |
| 42 (LetCont (k12) (InvokeContinuation k10 v11)) | |
| 43 (LetCont (k13) (InvokeContinuation k10 v3)) | |
| 44 (Branch (IsTrue v14) k12 k13)) | |
| 45 (InvokeMethod v4 == v13 k9)) | |
| 46 (InvokeMethod v12 unary- k8)) | |
| 47 (LetCont (k14) (InvokeContinuation k7 v3)) | |
| 48 (LetCont (k15) (InvokeContinuation k7 v2)) | |
| 49 (Branch (IsTrue v10) k14 k15)) | |
| 50 (InvokeMethod v4 == v9 k6)) | |
| 51 (InvokeMethod v8 unary- k5)) | |
| 52 (LetPrim v18 (Constant 10)) | |
| 53 (LetCont (k16 v19) (Branch (IsTrue v19) k4 k1)) | |
| 54 (InvokeMethod v4 < v18 k16)) | |
| 55 (InvokeContinuation k0 v0 v0 v1)) | |
| 56 """; | |
| 57 | |
| 58 String CYCLIC_DEPS_OUT = """ | |
| 59 (FunctionDefinition main (return) (LetPrim v0 (Constant 0)) | |
| 60 (LetPrim v1 (Constant 0)) | |
| 61 (LetCont* (k0 v2) | |
| 62 (LetCont (k1) | |
| 63 (LetCont (k2 v3) | |
| 64 (LetCont (k3 v4) (LetPrim v5 (Constant null)) | |
| 65 (InvokeContinuation return v5)) | |
| 66 (InvokeStatic print v0 k3)) | |
| 67 (InvokeStatic print v0 k2)) | |
| 68 (LetCont (k4) (LetPrim v6 (Constant 1)) | |
| 69 (LetCont (k5 v7) | |
| 70 (LetCont (k6 v8) | |
| 71 (LetCont (k7) (LetPrim v9 (Constant 1)) | |
| 72 (LetCont (k8 v10) | |
| 73 (LetCont (k9 v11) | |
| 74 (LetCont (k10) | |
| 75 (LetPrim v12 (Constant 1)) | |
| 76 (LetCont (k11 v13) | |
| 77 (InvokeContinuation* k0 v13)) | |
| 78 (InvokeMethod v2 + v12 k11)) | |
| 79 (LetCont (k12) (InvokeContinuation k10)) | |
| 80 (LetCont (k13) (InvokeContinuation k10)) | |
| 81 (Branch (IsTrue v11) k12 k13)) | |
| 82 (InvokeMethod v2 == v10 k9)) | |
| 83 (InvokeMethod v9 unary- k8)) | |
| 84 (LetCont (k14) (InvokeContinuation k7)) | |
| 85 (LetCont (k15) (InvokeContinuation k7)) | |
| 86 (Branch (IsTrue v8) k14 k15)) | |
| 87 (InvokeMethod v2 == v7 k6)) | |
| 88 (InvokeMethod v6 unary- k5)) | |
| 89 (LetPrim v14 (Constant 10)) | |
| 90 (LetCont (k16 v15) (Branch (IsTrue v15) k4 k1)) | |
| 91 (InvokeMethod v2 < v14 k16)) | |
| 92 (InvokeContinuation k0 v1)) | |
| 93 """; | |
| 94 | |
| 95 void main() { | |
| 96 testRedundantPhi(CYCLIC_DEPS_IN, CYCLIC_DEPS_OUT); | |
| 97 } | |
| OLD | NEW |