1# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14.record A { 15 A a 16} 17 18.function i32 foo_i() <external> 19.function i32 foo_iA(A a0) <external> 20.function A foo_AA(A a0) <external> 21 22#! CHECKER Definition with phi input in the same block 23#! RUN_LLVM options: "--compiler-regex=_GLOBAL::liveness_0 \ 24#! --llvm-gc-check=true --llvm-dump-after" 25#! READ_FILE "console.out" 26#! INST /%v5[0-9]* = phi ptr addrspace\(271\).* \[ %v9[0-9]*.rel.*, .* \]/ 27.function i32 liveness_0() { 28 newobj v0, A 29backedge: 30 call foo_AA, v0 # the definition and the phi input are in the same block 31 sta.obj v0 32 call foo_i # a statepoint 33 jeqz backedge 34 return 35exit: 36 ldai 42 37 return 38} 39 40#! CHECKER Do not propagate null value as a phi input 41#! RUN_LLVM options: "--compiler-regex=_GLOBAL::liveness_1 \ 42#! --llvm-gc-check=true --llvm-dump-after" 43#! READ_FILE "console.out" 44#! INST_NOT "(null, null)" 45.function i32 liveness_1() { 46 newobj v0, A 47backedge: 48 call foo_iA, v0 49 mov.null v0 50 jeqz backedge 51 return 52} 53