1 /* 2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.jtt.loop; 24 25 import org.junit.Test; 26 27 import org.graalvm.compiler.jtt.JTTTest; 28 29 /* 30 */ 31 32 public class LoopPhi extends JTTTest { 33 34 public static int test(int arg) { 35 for (int i = 0; i < arg; i++) { 36 testHelper(1, 1, 1, 1, 1, 1); 37 } 38 return testHelper(1, 1, 1, 1, 1, 1); 39 } 40 41 public static int testHelper(int j1, int j2, int j3, int j4, int j5, int j6) { 42 int i1 = j1; 43 int i2 = j2; 44 int i3 = j3; 45 int i4 = j4; 46 int i5 = j5; 47 int i6 = j6; 48 49 if (i1 == 0) { 50 i1 = 2; 51 } else { 52 i2 = 2; 53 } 54 for (int i = 0; i < 10; i++) { 55 if (i == 0) { 56 i3 = 2; 57 } else { 58 i4 = 2; 59 } 60 61 for (int j = 0; j < 10; j++) { 62 if (j == 0) { 63 i5 = 2; 64 } else { 65 i6 = 2; 66 } 67 } 68 } 69 70 return i1 + i2 + i3 + i4 + i5 + i6; 71 } 72 73 @Test 74 public void run0() throws Throwable { 75 runTest("test", 50000); 76 } 77 78 }