1*795d594fSAndroid Build Coastguard Worker# Copyright (C) 2015 The Android Open Source Project 2*795d594fSAndroid Build Coastguard Worker# 3*795d594fSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 4*795d594fSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 5*795d594fSAndroid Build Coastguard Worker# You may obtain a copy of the License at 6*795d594fSAndroid Build Coastguard Worker# 7*795d594fSAndroid Build Coastguard Worker# http://www.apache.org/licenses/LICENSE-2.0 8*795d594fSAndroid Build Coastguard Worker# 9*795d594fSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*795d594fSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, 11*795d594fSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*795d594fSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 13*795d594fSAndroid Build Coastguard Worker# limitations under the License. 14*795d594fSAndroid Build Coastguard Worker 15*795d594fSAndroid Build Coastguard Worker.class public LTestCase; 16*795d594fSAndroid Build Coastguard Worker.super Ljava/lang/Object; 17*795d594fSAndroid Build Coastguard Worker 18*795d594fSAndroid Build Coastguard Worker.field public static sField:I 19*795d594fSAndroid Build Coastguard Worker 20*795d594fSAndroid Build Coastguard Worker.method private static $inline$False()Z 21*795d594fSAndroid Build Coastguard Worker .registers 1 22*795d594fSAndroid Build Coastguard Worker const/4 v0, 0x0 23*795d594fSAndroid Build Coastguard Worker return v0 24*795d594fSAndroid Build Coastguard Worker.end method 25*795d594fSAndroid Build Coastguard Worker 26*795d594fSAndroid Build Coastguard Worker# Test a case when one entering TryBoundary is dead but the rest of the try 27*795d594fSAndroid Build Coastguard Worker# block remains live. 28*795d594fSAndroid Build Coastguard Worker 29*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testDeadEntry(int, int, int, int) dead_code_elimination$after_inlining (before) 30*795d594fSAndroid Build Coastguard Worker## CHECK: Add 31*795d594fSAndroid Build Coastguard Worker 32*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testDeadEntry(int, int, int, int) dead_code_elimination$after_inlining (before) 33*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:entry 34*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:entry 35*795d594fSAndroid Build Coastguard Worker## CHECK-NOT: TryBoundary kind:entry 36*795d594fSAndroid Build Coastguard Worker 37*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testDeadEntry(int, int, int, int) dead_code_elimination$after_inlining (after) 38*795d594fSAndroid Build Coastguard Worker## CHECK-NOT: Add 39*795d594fSAndroid Build Coastguard Worker 40*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testDeadEntry(int, int, int, int) dead_code_elimination$after_inlining (after) 41*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:entry 42*795d594fSAndroid Build Coastguard Worker## CHECK-NOT: TryBoundary kind:entry 43*795d594fSAndroid Build Coastguard Worker 44*795d594fSAndroid Build Coastguard Worker.method public static testDeadEntry(IIII)I 45*795d594fSAndroid Build Coastguard Worker .registers 5 46*795d594fSAndroid Build Coastguard Worker 47*795d594fSAndroid Build Coastguard Worker invoke-static {}, LTestCase;->$inline$False()Z 48*795d594fSAndroid Build Coastguard Worker move-result v0 49*795d594fSAndroid Build Coastguard Worker 50*795d594fSAndroid Build Coastguard Worker if-eqz v0, :else 51*795d594fSAndroid Build Coastguard Worker 52*795d594fSAndroid Build Coastguard Worker add-int/2addr p0, p1 53*795d594fSAndroid Build Coastguard Worker 54*795d594fSAndroid Build Coastguard Worker :try_start 55*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p2 56*795d594fSAndroid Build Coastguard Worker 57*795d594fSAndroid Build Coastguard Worker :else 58*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p3 59*795d594fSAndroid Build Coastguard Worker :try_end 60*795d594fSAndroid Build Coastguard Worker .catchall {:try_start .. :try_end} :catch_all 61*795d594fSAndroid Build Coastguard Worker 62*795d594fSAndroid Build Coastguard Worker :return 63*795d594fSAndroid Build Coastguard Worker return p0 64*795d594fSAndroid Build Coastguard Worker 65*795d594fSAndroid Build Coastguard Worker :catch_all 66*795d594fSAndroid Build Coastguard Worker const/4 p0, -0x1 67*795d594fSAndroid Build Coastguard Worker goto :return 68*795d594fSAndroid Build Coastguard Worker 69*795d594fSAndroid Build Coastguard Worker.end method 70*795d594fSAndroid Build Coastguard Worker 71*795d594fSAndroid Build Coastguard Worker# Test a case when one exiting TryBoundary is dead but the rest of the try 72*795d594fSAndroid Build Coastguard Worker# block remains live. 73*795d594fSAndroid Build Coastguard Worker 74*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testDeadExit(int, int, int, int) dead_code_elimination$after_inlining (before) 75*795d594fSAndroid Build Coastguard Worker## CHECK: Add 76*795d594fSAndroid Build Coastguard Worker 77*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testDeadExit(int, int, int, int) dead_code_elimination$after_inlining (before) 78*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:exit 79*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:exit 80*795d594fSAndroid Build Coastguard Worker## CHECK-NOT: TryBoundary kind:exit 81*795d594fSAndroid Build Coastguard Worker 82*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testDeadExit(int, int, int, int) dead_code_elimination$after_inlining (after) 83*795d594fSAndroid Build Coastguard Worker## CHECK-NOT: Add 84*795d594fSAndroid Build Coastguard Worker 85*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testDeadExit(int, int, int, int) dead_code_elimination$after_inlining (after) 86*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:exit 87*795d594fSAndroid Build Coastguard Worker## CHECK-NOT: TryBoundary kind:exit 88*795d594fSAndroid Build Coastguard Worker 89*795d594fSAndroid Build Coastguard Worker.method public static testDeadExit(IIII)I 90*795d594fSAndroid Build Coastguard Worker .registers 5 91*795d594fSAndroid Build Coastguard Worker 92*795d594fSAndroid Build Coastguard Worker invoke-static {}, LTestCase;->$inline$False()Z 93*795d594fSAndroid Build Coastguard Worker move-result v0 94*795d594fSAndroid Build Coastguard Worker 95*795d594fSAndroid Build Coastguard Worker :try_start 96*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p2 97*795d594fSAndroid Build Coastguard Worker 98*795d594fSAndroid Build Coastguard Worker if-nez v0, :else 99*795d594fSAndroid Build Coastguard Worker 100*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p3 101*795d594fSAndroid Build Coastguard Worker goto :return 102*795d594fSAndroid Build Coastguard Worker :try_end 103*795d594fSAndroid Build Coastguard Worker .catchall {:try_start .. :try_end} :catch_all 104*795d594fSAndroid Build Coastguard Worker 105*795d594fSAndroid Build Coastguard Worker :else 106*795d594fSAndroid Build Coastguard Worker add-int/2addr p0, p1 107*795d594fSAndroid Build Coastguard Worker 108*795d594fSAndroid Build Coastguard Worker :return 109*795d594fSAndroid Build Coastguard Worker return p0 110*795d594fSAndroid Build Coastguard Worker 111*795d594fSAndroid Build Coastguard Worker :catch_all 112*795d594fSAndroid Build Coastguard Worker const/4 p0, -0x1 113*795d594fSAndroid Build Coastguard Worker goto :return 114*795d594fSAndroid Build Coastguard Worker 115*795d594fSAndroid Build Coastguard Worker.end method 116*795d594fSAndroid Build Coastguard Worker 117*795d594fSAndroid Build Coastguard Worker# Test that a catch block remains live and consistent if some of try blocks 118*795d594fSAndroid Build Coastguard Worker# throwing into it are removed. 119*795d594fSAndroid Build Coastguard Worker 120*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testOneTryBlockDead(int, int, int, int) dead_code_elimination$after_inlining (before) 121*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:entry 122*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:entry 123*795d594fSAndroid Build Coastguard Worker## CHECK-NOT: TryBoundary kind:entry 124*795d594fSAndroid Build Coastguard Worker 125*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testOneTryBlockDead(int, int, int, int) dead_code_elimination$after_inlining (before) 126*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:exit 127*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:exit 128*795d594fSAndroid Build Coastguard Worker## CHECK-NOT: TryBoundary kind:exit 129*795d594fSAndroid Build Coastguard Worker 130*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testOneTryBlockDead(int, int, int, int) dead_code_elimination$after_inlining (after) 131*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:entry 132*795d594fSAndroid Build Coastguard Worker## CHECK-NOT: TryBoundary kind:entry 133*795d594fSAndroid Build Coastguard Worker 134*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testOneTryBlockDead(int, int, int, int) dead_code_elimination$after_inlining (after) 135*795d594fSAndroid Build Coastguard Worker## CHECK: TryBoundary kind:exit 136*795d594fSAndroid Build Coastguard Worker## CHECK-NOT: TryBoundary kind:exit 137*795d594fSAndroid Build Coastguard Worker 138*795d594fSAndroid Build Coastguard Worker.method public static testOneTryBlockDead(IIII)I 139*795d594fSAndroid Build Coastguard Worker .registers 5 140*795d594fSAndroid Build Coastguard Worker 141*795d594fSAndroid Build Coastguard Worker invoke-static {}, LTestCase;->$inline$False()Z 142*795d594fSAndroid Build Coastguard Worker move-result v0 143*795d594fSAndroid Build Coastguard Worker 144*795d594fSAndroid Build Coastguard Worker :try_start_1 145*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p2 146*795d594fSAndroid Build Coastguard Worker :try_end_1 147*795d594fSAndroid Build Coastguard Worker .catchall {:try_start_1 .. :try_end_1} :catch_all 148*795d594fSAndroid Build Coastguard Worker 149*795d594fSAndroid Build Coastguard Worker if-eqz v0, :return 150*795d594fSAndroid Build Coastguard Worker 151*795d594fSAndroid Build Coastguard Worker :try_start_2 152*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p3 153*795d594fSAndroid Build Coastguard Worker :try_end_2 154*795d594fSAndroid Build Coastguard Worker .catchall {:try_start_2 .. :try_end_2} :catch_all 155*795d594fSAndroid Build Coastguard Worker 156*795d594fSAndroid Build Coastguard Worker :return 157*795d594fSAndroid Build Coastguard Worker return p0 158*795d594fSAndroid Build Coastguard Worker 159*795d594fSAndroid Build Coastguard Worker :catch_all 160*795d594fSAndroid Build Coastguard Worker const/4 p0, -0x1 161*795d594fSAndroid Build Coastguard Worker goto :return 162*795d594fSAndroid Build Coastguard Worker 163*795d594fSAndroid Build Coastguard Worker.end method 164*795d594fSAndroid Build Coastguard Worker 165*795d594fSAndroid Build Coastguard Worker# Test that try block membership is recomputed. In this test case, the try entry 166*795d594fSAndroid Build Coastguard Worker# stored with the merge block gets deleted and SSAChecker would fail if it was 167*795d594fSAndroid Build Coastguard Worker# not replaced with the try entry from the live branch. 168*795d594fSAndroid Build Coastguard Worker 169*795d594fSAndroid Build Coastguard Worker.method public static testRecomputeTryMembership(IIII)I 170*795d594fSAndroid Build Coastguard Worker .registers 5 171*795d594fSAndroid Build Coastguard Worker 172*795d594fSAndroid Build Coastguard Worker invoke-static {}, LTestCase;->$inline$False()Z 173*795d594fSAndroid Build Coastguard Worker move-result v0 174*795d594fSAndroid Build Coastguard Worker 175*795d594fSAndroid Build Coastguard Worker if-eqz v0, :else 176*795d594fSAndroid Build Coastguard Worker 177*795d594fSAndroid Build Coastguard Worker # Dead branch 178*795d594fSAndroid Build Coastguard Worker :try_start 179*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p1 180*795d594fSAndroid Build Coastguard Worker goto :merge 181*795d594fSAndroid Build Coastguard Worker 182*795d594fSAndroid Build Coastguard Worker # Live branch 183*795d594fSAndroid Build Coastguard Worker :else 184*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p2 185*795d594fSAndroid Build Coastguard Worker 186*795d594fSAndroid Build Coastguard Worker # Merge block. Make complex so it does not get merged with the live branch. 187*795d594fSAndroid Build Coastguard Worker :merge 188*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p3 189*795d594fSAndroid Build Coastguard Worker if-eqz p0, :else2 190*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p3 191*795d594fSAndroid Build Coastguard Worker :else2 192*795d594fSAndroid Build Coastguard Worker :try_end 193*795d594fSAndroid Build Coastguard Worker .catchall {:try_start .. :try_end} :catch_all 194*795d594fSAndroid Build Coastguard Worker 195*795d594fSAndroid Build Coastguard Worker :return 196*795d594fSAndroid Build Coastguard Worker return p0 197*795d594fSAndroid Build Coastguard Worker 198*795d594fSAndroid Build Coastguard Worker :catch_all 199*795d594fSAndroid Build Coastguard Worker const/4 p0, -0x1 200*795d594fSAndroid Build Coastguard Worker goto :return 201*795d594fSAndroid Build Coastguard Worker 202*795d594fSAndroid Build Coastguard Worker.end method 203*795d594fSAndroid Build Coastguard Worker 204*795d594fSAndroid Build Coastguard Worker# Test that DCE removes catch phi uses of instructions defined in dead try blocks. 205*795d594fSAndroid Build Coastguard Worker 206*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testCatchPhiInputs_DefinedInTryBlock(int, int, int, int) dead_code_elimination$after_inlining (before) 207*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Arg0:i\d+>> ParameterValue 208*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Arg1:i\d+>> ParameterValue 209*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0x0:i\d+>> IntConstant 0 210*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xa:i\d+>> IntConstant 10 211*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xb:i\d+>> IntConstant 11 212*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xc:i\d+>> IntConstant 12 213*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xd:i\d+>> IntConstant 13 214*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xe:i\d+>> IntConstant 14 215*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xf:i\d+>> IntConstant 15 216*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0x10:i\d+>> IntConstant 16 217*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0x11:i\d+>> IntConstant 17 218*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Add:i\d+>> Add [<<Arg0>>,<<Arg1>>] 219*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Phi:i\d+>> Phi [<<Const0x0>>,<<Const0xf>>] reg:3 is_catch_phi:false 220*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: Phi [<<Const0xa>>,<<Const0xb>>,<<Const0xd>>] reg:1 is_catch_phi:true 221*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: Phi [<<Add>>,<<Const0xc>>,<<Const0xe>>] reg:2 is_catch_phi:true 222*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: Phi [<<Phi>>,<<Const0x10>>,<<Const0x11>>] reg:3 is_catch_phi:true 223*795d594fSAndroid Build Coastguard Worker 224*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testCatchPhiInputs_DefinedInTryBlock(int, int, int, int) dead_code_elimination$after_inlining (after) 225*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xb:i\d+>> IntConstant 11 226*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xc:i\d+>> IntConstant 12 227*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xd:i\d+>> IntConstant 13 228*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xe:i\d+>> IntConstant 14 229*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0x10:i\d+>> IntConstant 16 230*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0x11:i\d+>> IntConstant 17 231*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: Phi [<<Const0xb>>,<<Const0xd>>] reg:1 is_catch_phi:true 232*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: Phi [<<Const0xc>>,<<Const0xe>>] reg:2 is_catch_phi:true 233*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: Phi [<<Const0x10>>,<<Const0x11>>] reg:3 is_catch_phi:true 234*795d594fSAndroid Build Coastguard Worker 235*795d594fSAndroid Build Coastguard Worker.method public static testCatchPhiInputs_DefinedInTryBlock(IIII)I 236*795d594fSAndroid Build Coastguard Worker .registers 8 237*795d594fSAndroid Build Coastguard Worker 238*795d594fSAndroid Build Coastguard Worker invoke-static {}, LTestCase;->$inline$False()Z 239*795d594fSAndroid Build Coastguard Worker move-result v0 240*795d594fSAndroid Build Coastguard Worker 241*795d594fSAndroid Build Coastguard Worker if-eqz v0, :else 242*795d594fSAndroid Build Coastguard Worker 243*795d594fSAndroid Build Coastguard Worker shr-int/2addr p2, p3 244*795d594fSAndroid Build Coastguard Worker 245*795d594fSAndroid Build Coastguard Worker :try_start 246*795d594fSAndroid Build Coastguard Worker const v1, 0xa # dead catch phi input, defined in entry block (HInstruction) 247*795d594fSAndroid Build Coastguard Worker add-int v2, p0, p1 # dead catch phi input, defined in the dead block (HInstruction) 248*795d594fSAndroid Build Coastguard Worker move v3, v2 249*795d594fSAndroid Build Coastguard Worker if-eqz v3, :define_phi 250*795d594fSAndroid Build Coastguard Worker const v3, 0xf 251*795d594fSAndroid Build Coastguard Worker :define_phi 252*795d594fSAndroid Build Coastguard Worker # v3 = Phi [Add, 0xf] # dead catch phi input, defined in the dead block (HPhi). 253*795d594fSAndroid Build Coastguard Worker # Note that the Add has to be equal to 0 since we do `if-eqz v3` 254*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, v2 255*795d594fSAndroid Build Coastguard Worker 256*795d594fSAndroid Build Coastguard Worker :else 257*795d594fSAndroid Build Coastguard Worker const v1, 0xb # live catch phi input 258*795d594fSAndroid Build Coastguard Worker const v2, 0xc # live catch phi input 259*795d594fSAndroid Build Coastguard Worker const v3, 0x10 # live catch phi input 260*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p3 261*795d594fSAndroid Build Coastguard Worker 262*795d594fSAndroid Build Coastguard Worker const v1, 0xd # live catch phi input 263*795d594fSAndroid Build Coastguard Worker const v2, 0xe # live catch phi input 264*795d594fSAndroid Build Coastguard Worker const v3, 0x11 # live catch phi input 265*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p1 266*795d594fSAndroid Build Coastguard Worker :try_end 267*795d594fSAndroid Build Coastguard Worker .catchall {:try_start .. :try_end} :catch_all 268*795d594fSAndroid Build Coastguard Worker 269*795d594fSAndroid Build Coastguard Worker :return 270*795d594fSAndroid Build Coastguard Worker return p0 271*795d594fSAndroid Build Coastguard Worker 272*795d594fSAndroid Build Coastguard Worker :catch_all 273*795d594fSAndroid Build Coastguard Worker sub-int p0, v1, v2 # use catch phi values 274*795d594fSAndroid Build Coastguard Worker sub-int p0, p0, v3 # use catch phi values 275*795d594fSAndroid Build Coastguard Worker goto :return 276*795d594fSAndroid Build Coastguard Worker 277*795d594fSAndroid Build Coastguard Worker.end method 278*795d594fSAndroid Build Coastguard Worker 279*795d594fSAndroid Build Coastguard Worker# Test that DCE does not remove catch phi uses of instructions defined outside 280*795d594fSAndroid Build Coastguard Worker# dead try blocks. 281*795d594fSAndroid Build Coastguard Worker 282*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testCatchPhiInputs_DefinedOutsideTryBlock(int, int, int, int) dead_code_elimination$after_inlining (before) 283*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xa:i\d+>> IntConstant 10 284*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xb:i\d+>> IntConstant 11 285*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xc:i\d+>> IntConstant 12 286*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xd:i\d+>> IntConstant 13 287*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xe:i\d+>> IntConstant 14 288*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xf:i\d+>> IntConstant 15 289*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: Phi [<<Const0xa>>,<<Const0xb>>,<<Const0xd>>] reg:1 is_catch_phi:true 290*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: Phi [<<Const0xf>>,<<Const0xc>>,<<Const0xe>>] reg:2 is_catch_phi:true 291*795d594fSAndroid Build Coastguard Worker 292*795d594fSAndroid Build Coastguard Worker## CHECK-START: int TestCase.testCatchPhiInputs_DefinedOutsideTryBlock(int, int, int, int) dead_code_elimination$after_inlining (after) 293*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xa:i\d+>> IntConstant 10 294*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xb:i\d+>> IntConstant 11 295*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xc:i\d+>> IntConstant 12 296*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xd:i\d+>> IntConstant 13 297*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xe:i\d+>> IntConstant 14 298*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: <<Const0xf:i\d+>> IntConstant 15 299*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: Phi [<<Const0xa>>,<<Const0xb>>,<<Const0xd>>] reg:1 is_catch_phi:true 300*795d594fSAndroid Build Coastguard Worker## CHECK-DAG: Phi [<<Const0xf>>,<<Const0xc>>,<<Const0xe>>] reg:2 is_catch_phi:true 301*795d594fSAndroid Build Coastguard Worker 302*795d594fSAndroid Build Coastguard Worker.method public static testCatchPhiInputs_DefinedOutsideTryBlock(IIII)I 303*795d594fSAndroid Build Coastguard Worker .registers 7 304*795d594fSAndroid Build Coastguard Worker 305*795d594fSAndroid Build Coastguard Worker invoke-static {}, LTestCase;->$inline$False()Z 306*795d594fSAndroid Build Coastguard Worker move-result v0 307*795d594fSAndroid Build Coastguard Worker 308*795d594fSAndroid Build Coastguard Worker if-eqz v0, :else 309*795d594fSAndroid Build Coastguard Worker 310*795d594fSAndroid Build Coastguard Worker shr-int/2addr p2, p3 311*795d594fSAndroid Build Coastguard Worker 312*795d594fSAndroid Build Coastguard Worker :try_start 313*795d594fSAndroid Build Coastguard Worker const v1, 0xa # dead catch phi input, defined in entry block 314*795d594fSAndroid Build Coastguard Worker const v2, 0xf # dead catch phi input, defined in entry block 315*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, v2 316*795d594fSAndroid Build Coastguard Worker 317*795d594fSAndroid Build Coastguard Worker :else 318*795d594fSAndroid Build Coastguard Worker const v1, 0xb # live catch phi input 319*795d594fSAndroid Build Coastguard Worker const v2, 0xc # live catch phi input 320*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p3 321*795d594fSAndroid Build Coastguard Worker 322*795d594fSAndroid Build Coastguard Worker const v1, 0xd # live catch phi input 323*795d594fSAndroid Build Coastguard Worker const v2, 0xe # live catch phi input 324*795d594fSAndroid Build Coastguard Worker div-int/2addr p0, p1 325*795d594fSAndroid Build Coastguard Worker :try_end 326*795d594fSAndroid Build Coastguard Worker .catchall {:try_start .. :try_end} :catch_all 327*795d594fSAndroid Build Coastguard Worker 328*795d594fSAndroid Build Coastguard Worker :return 329*795d594fSAndroid Build Coastguard Worker return p0 330*795d594fSAndroid Build Coastguard Worker 331*795d594fSAndroid Build Coastguard Worker :catch_all 332*795d594fSAndroid Build Coastguard Worker sub-int p0, v1, v2 # use catch phi values 333*795d594fSAndroid Build Coastguard Worker goto :return 334*795d594fSAndroid Build Coastguard Worker 335*795d594fSAndroid Build Coastguard Worker.end method 336