Skip to content

[SPIRV] Pointer legalization fails due to unimplemented downcasts #136780

Open
@winocm

Description

@winocm

It looks like the pointer legalization bitcast pass fails horrifically if there is a GEP instruction used before that does not end up feeding into the actual load. Stores also similarly fail.

Here is a minimal test case reproducing this issue:

%struct.Uniforms = type { %struct.Matrix, %struct.Matrix }
%struct.Matrix = type { [4 x <4 x float>] }

define void @foo(ptr addrspace(2) %0) {
  %2 = getelementptr inbounds %struct.Uniforms, ptr addrspace(2) %0, i64 0, i32 0, i32 0, i64 10
  %3 = load volatile <4 x float>, ptr addrspace(2) %0, align 16
  ret void
}

define void @foo2(ptr addrspace(2) %0) {
  %2 = getelementptr inbounds %struct.Uniforms, ptr addrspace(2) %0, i64 0, i32 0, i32 0, i64 10
  store volatile <4 x float> splat (float 0.0), ptr addrspace(2) %0, align 16
  ret void
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions