llvm-project
494f6728 - [SPIR-V] Prevent type change of GEP results in type inference (#129250)

Commit
251 days ago
[SPIR-V] Prevent type change of GEP results in type inference (#129250) The following reproducer demonstrates the issue with invalid definition of GEP results during type inference ``` define spir_kernel void @foo(i1 %fl, i64 %idx, ptr addrspace(1) %dest, ptr addrspace(3) %src) { %p1 = getelementptr inbounds i8, ptr addrspace(1) %dest, i64 %idx %res = tail call spir_func target("spirv.Event") @_Z22__spirv_GroupAsyncCopyjPU3AS1iPU3AS3Kimm9ocl_event(i32 2, ptr addrspace(1) %p1, ptr addrspace(3) %src, i64 128, i64 1, target("spirv.Event") zeroinitializer) ret void } declare dso_local spir_func target("spirv.Event") @_Z22__spirv_GroupAsyncCopyjPU3AS1iPU3AS3Kimm9ocl_event(i32, ptr addrspace(1), ptr addrspace(3), i64, i64, target("spirv.Event")) ``` Here `OpGroupAsyncCopy` expects i32* arguments and type inference fails to set a correct type of the GEP result `%p1`, because it is an argument of `OpGroupAsyncCopy`. This PR fixes the issue by preventing type change of GEP results in type inference.
Parents
Loading