Issue 165473
Summary [DirectX] DXIL array flattener is incorrectly transforming GEPs
Labels backend:DirectX
Assignees Icohedron
Reporter Icohedron
    GEPs are incorrectly transformed in some cases by the DXIL array flattener pass.

https://godbolt.org/z/v5G5Ka9vz

```llvm
define ptr @CSMain(i32 %i) {
entry:
  %arr = alloca [8 x [4 x float]], align 4
  %gep = getelementptr inbounds nuw [8 x [4 x float]], ptr %arr, i32 %i
  ret ptr %gep
}
```
Results in an incorrectly-transformed GEP
```llvm
define ptr @CSMain(i32 %i) {
entry:
  %arr.1dim = alloca [32 x float], align 4
  %0 = mul i32 %i, 32
  %1 = add i32 0, %0
  %gep1 = getelementptr inbounds nuw [32 x float], ptr %arr.1dim, i32 0, i32 %1
  ret ptr %gep1
}
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to