1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 public class Main { main(String[] args)18 public static void main(String[] args) {} 19 20 /// CHECK-START: int Main.$noinline$doNothing() dead_code_elimination$after_inlining (before) 21 /// CHECK-DAG: Phi 22 /// CHECK-DAG: Add 23 /// CHECK-DAG: Div 24 25 /// CHECK-START: int Main.$noinline$doNothing() dead_code_elimination$after_inlining (after) 26 /// CHECK-NOT: Phi 27 /// CHECK-NOT: Add 28 /// CHECK-NOT: Div $noinline$doNothing()29 private int $noinline$doNothing() { 30 int val1 = b1 ? 1 : 0; 31 int val2 = b2 ? 1 : 0; 32 33 if (condition1) { 34 val1 += 25; 35 val2 += 25; 36 } 37 38 if (condition2) { 39 val1 /= 5; 40 val2 /= 5; 41 } 42 43 if ($inline$returnFalse()) { 44 return val1 + val2; 45 } else { 46 return 0; 47 } 48 } 49 $inline$returnFalse()50 private boolean $inline$returnFalse() { 51 return false; 52 } 53 54 boolean b1; 55 boolean b2; 56 boolean condition1; 57 boolean condition2; 58 } 59