Issue 166203
Summary [DirectX] Data scalarization pass does not account for struct types
Labels backend:DirectX
Assignees
Reporter inbelic
    Part of the data scalarization is to replace all uses of vectors with arrays.

Currently it will not account for vectors that are within a struct type, as struct types were explicitly ignored to resolve https://github.com/llvm/llvm-project/issues/145408.

This issue is resolved when a vector type embedded in a struct type is also converted to an array for alloca's and global variables.

>From https://godbolt.org/z/bEqsT74nn:

```llvm
%struct.RawStruct8D = type { [8 x <4 x i32> ] }

; CHECK: %struct.RawStruct8D.scalarized = type { [8 x [4 x i32]] }

define void @test_no_transform_of_struct()  {
entry:
 %outputSizesLocal.i = alloca %struct.RawStruct8D, align 4
 %arrayinit.element13.i76 = getelementptr inbounds nuw [1 x %struct.RawStruct8D], ptr %outputSizesLocal.i, i32 0, i32 0
  ; CHECK: %gep = getelementptr inbounds nuw [8 x [4 x i32] ] ...
 %arrayinit.element13.i76.i1 = getelementptr inbounds nuw [8 x <4 x i32>], ptr %arrayinit.element13.i76, i32 0, i32 1
    ret void
}
```

This was surfaced during implementation of https://github.com/llvm/llvm-project/pull/166200 and can be used as an example for test-cases.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to