Skip to content

Commit 05137cc

Browse files
authored
[AsmParser] Convert empty arrays to poison (#119754)
Empty arrays can be converted to `poison` instead of `undef`.
1 parent bd40421 commit 05137cc

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6185,7 +6185,7 @@ bool LLParser::convertValIDToValue(Type *Ty, ValID &ID, Value *&V,
61856185
case ValID::t_EmptyArray:
61866186
if (!Ty->isArrayTy() || cast<ArrayType>(Ty)->getNumElements() != 0)
61876187
return error(ID.Loc, "invalid empty array initializer");
6188-
V = UndefValue::get(Ty);
6188+
V = PoisonValue::get(Ty);
61896189
return false;
61906190
case ValID::t_Zero:
61916191
// FIXME: LabelTy should not be a first-class type.

llvm/test/Assembler/aggregate-constant-values.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ define void @bar(ptr %x) nounwind {
2626
}
2727

2828
; CHECK: @bar_empty
29-
; CHECK: store [0 x i32] undef, ptr %x
29+
; CHECK: store [0 x i32] poison, ptr %x
3030
; CHECK: ret
3131
define void @bar_empty(ptr %x) nounwind {
3232
store [0 x i32][], ptr %x

llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ define amdgpu_kernel void @v2float_stack(ptr addrspace(1) %out, i32 %a) {
504504
}
505505

506506
; OPT-LABEL: @direct_alloca_read_0xi32(
507-
; OPT: store [0 x i32] undef, ptr addrspace(3)
507+
; OPT: store [0 x i32] poison, ptr addrspace(3)
508508
; OPT: load [0 x i32], ptr addrspace(3)
509509
define amdgpu_kernel void @direct_alloca_read_0xi32(ptr addrspace(1) %out, i32 %index) {
510510
entry:

0 commit comments

Comments
 (0)