1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s 2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %} 3 4; CHECK: %[[#Char:]] = OpTypeInt 8 0 5; CHECK: %[[#Ptr:]] = OpTypePointer Generic %[[#Char]] 6; CHECK: %[[#TypeDef:]] = OpTypePointer Generic %[[#Ptr]] 7; CHECK-NOT: %[[#TypeDef]] = OpTypePointer Generic %[[#Ptr]] 8 9%Range = type { %Array } 10%Array = type { [1 x i64] } 11 12define spir_func ptr addrspace(4) @foo(ptr addrspace(4) dereferenceable_or_null(32) %this) { 13entry: 14 %addr = alloca ptr addrspace(4) 15 store ptr addrspace(4) %this, ptr %addr 16 %arrayidx = getelementptr inbounds ptr addrspace(4), ptr addrspace(1) null, i64 0 17 %r = addrspacecast ptr addrspace(1) %arrayidx to ptr addrspace(4) 18 ret ptr addrspace(4) %r 19} 20 21define spir_func void @bar() { 22entry: 23 %retval = alloca ptr addrspace(4) 24 %retval.ascast = addrspacecast ptr %retval to ptr addrspace(4) 25 ret void 26} 27