; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -S -passes=infer-address-spaces %s | FileCheck %s
define amdgpu_kernel void @phi_self(ptr addrspace(1) %arg) {
; CHECK-LABEL: @phi_self(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[I:%.*]] = phi ptr addrspace(1) [ [[I]], [[LOOP]] ], [ [[ARG:%.*]], [[ENTRY:%.*]] ]
; CHECK-NEXT: [[I1:%.*]] = load i8, ptr addrspace(1) [[I]], align 1
; CHECK-NEXT: [[I2:%.*]] = icmp eq i8 [[I1]], 0
; CHECK-NEXT: br i1 [[I2]], label [[LOOP]], label [[RET:%.*]]
; CHECK: ret:
; CHECK-NEXT: ret void
;
entry:
%cast = addrspacecast ptr addrspace(1) %arg to ptr
br label %loop
loop:
%i = phi ptr [%i, %loop], [%cast, %entry]
%i1 = load i8, ptr %i, align 1
%i2 = icmp eq i8 %i1, 0
br i1 %i2, label %loop, label %ret
ret:
ret void
}