Two bugs here. First calling `Inst->getFunction()` has undefined behavior if the instruction is not tracked to a function. I suspect the `replaceAllUsesWith` was leaving the GEPs in a weird ghost parent situation. I switched up the visitor to be able to `eraseFromParent` as part of visiting and then everything started working. The second bug was in `DXILFlattenArrays.cpp`. I was unaware that you can have multidimensional arrays of `zeroinitializer`, and `undef` so fixed up the initializer to handle these two cases. fixes #117273
24 lines
1.0 KiB
LLVM
24 lines
1.0 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
|
|
; RUN: opt -S -passes='dxil-flatten-arrays,dxil-op-lower' -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
|
|
|
|
|
|
@ZerroInitArr = internal constant [2 x [3 x float]] [[3 x float] zeroinitializer, [3 x float] [float 1.000000e+00, float 1.000000e+00, float 1.000000e+00]], align 16
|
|
|
|
|
|
define internal void @main() {
|
|
; CHECK-LABEL: define internal void @main() {
|
|
; CHECK-NEXT: [[ENTRY:.*:]]
|
|
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr [24 x float], ptr @ZerroInitArr.1dim, i32 1
|
|
; CHECK-NEXT: [[DOTI0:%.*]] = load float, ptr [[TMP0]], align 16
|
|
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr [24 x float], ptr @ZerroInitArr.1dim, i32 2
|
|
; CHECK-NEXT: [[DOTI03:%.*]] = load float, ptr [[TMP1]], align 16
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
%0 = getelementptr [8 x [3 x float]], ptr @ZerroInitArr, i32 0, i32 1
|
|
%.i0 = load float, ptr %0, align 16
|
|
%1 = getelementptr [8 x [3 x float]], ptr @ZerroInitArr, i32 0, i32 2
|
|
%.i03 = load float, ptr %1, align 16
|
|
ret void
|
|
}
|