Skip to content

Commit 7f234b1

Browse files
committed
remove nested undef handling
1 parent 340e46a commit 7f234b1

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

llvm/lib/Target/DirectX/DXILFlattenArrays.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,6 @@ static void collectElements(Constant *Init,
341341
Elements.push_back(Constant::getNullValue(ArrayTy->getElementType()));
342342
return;
343343
}
344-
if (isa<UndefValue>(Init)) {
345-
for (unsigned I = 0; I < ArrSize; ++I)
346-
Elements.push_back(UndefValue::get(ArrayTy->getElementType()));
347-
return;
348-
}
349344

350345
// Recursive case: Process each element in the array.
351346
if (auto *ArrayConstant = dyn_cast<ConstantArray>(Init)) {

llvm/test/CodeGen/DirectX/flatten-bug-117273.ll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
; RUN: opt -S -passes='dxil-flatten-arrays,dxil-op-lower' -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
33

44

5-
@ZerroInitAndUndefArr = internal constant [2 x [3 x float]] [[3 x float] zeroinitializer, [3 x float] undef], align 16
5+
@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
66

77

88
define internal void @main() {
99
; CHECK-LABEL: define internal void @main() {
1010
; CHECK-NEXT: [[ENTRY:.*:]]
11-
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr [24 x float], ptr @ZerroInitAndUndefArr.1dim, i32 1
11+
; CHECK-NEXT: [[TMP0:%.*]] = getelementptr [24 x float], ptr @ZerroInitArr.1dim, i32 1
1212
; CHECK-NEXT: [[DOTI0:%.*]] = load float, ptr [[TMP0]], align 16
13-
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr [24 x float], ptr @ZerroInitAndUndefArr.1dim, i32 2
13+
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr [24 x float], ptr @ZerroInitArr.1dim, i32 2
1414
; CHECK-NEXT: [[DOTI03:%.*]] = load float, ptr [[TMP1]], align 16
1515
; CHECK-NEXT: ret void
1616
;
1717
entry:
18-
%0 = getelementptr [8 x [3 x float]], ptr @ZerroInitAndUndefArr, i32 0, i32 1
18+
%0 = getelementptr [8 x [3 x float]], ptr @ZerroInitArr, i32 0, i32 1
1919
%.i0 = load float, ptr %0, align 16
20-
%1 = getelementptr [8 x [3 x float]], ptr @ZerroInitAndUndefArr, i32 0, i32 2
20+
%1 = getelementptr [8 x [3 x float]], ptr @ZerroInitArr, i32 0, i32 2
2121
%.i03 = load float, ptr %1, align 16
2222
ret void
2323
}

0 commit comments

Comments
 (0)