1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -S -infer-address-spaces %s | FileCheck %s
3
4define amdgpu_kernel void @phi_self(i8 addrspace(1)* %arg) {
5; CHECK-LABEL: @phi_self(
6; CHECK-NEXT:  entry:
7; CHECK-NEXT:    br label [[LOOP:%.*]]
8; CHECK:       loop:
9; CHECK-NEXT:    [[I:%.*]] = phi i8 addrspace(1)* [ [[I]], [[LOOP]] ], [ [[ARG:%.*]], [[ENTRY:%.*]] ]
10; CHECK-NEXT:    [[I1:%.*]] = load i8, i8 addrspace(1)* [[I]], align 1
11; CHECK-NEXT:    [[I2:%.*]] = icmp eq i8 [[I1]], 0
12; CHECK-NEXT:    br i1 [[I2]], label [[LOOP]], label [[RET:%.*]]
13; CHECK:       ret:
14; CHECK-NEXT:    ret void
15;
16entry:
17  %cast = addrspacecast i8 addrspace(1)* %arg to i8*
18  br label %loop
19
20loop:
21  %i = phi i8* [%i, %loop], [%cast, %entry]
22  %i1 = load i8, i8* %i, align 1
23  %i2 = icmp eq i8 %i1, 0
24  br i1 %i2, label %loop, label %ret
25
26ret:
27  ret void
28}
29