[llvm] [AsmParser] Convert empty arrays to `poison` (PR #119754)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 12 12:09:33 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Pedro Lobo (pedroclobo)
<details>
<summary>Changes</summary>
Empty arrays can be converted to `poison` instead of `undef`.
---
Full diff: https://github.com/llvm/llvm-project/pull/119754.diff
3 Files Affected:
- (modified) llvm/lib/AsmParser/LLParser.cpp (+1-1)
- (modified) llvm/test/Assembler/aggregate-constant-values.ll (+1-1)
- (modified) llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll (+1-1)
``````````diff
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 34311499367b41..558ab3af632117 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -6185,7 +6185,7 @@ bool LLParser::convertValIDToValue(Type *Ty, ValID &ID, Value *&V,
case ValID::t_EmptyArray:
if (!Ty->isArrayTy() || cast<ArrayType>(Ty)->getNumElements() != 0)
return error(ID.Loc, "invalid empty array initializer");
- V = UndefValue::get(Ty);
+ V = PoisonValue::get(Ty);
return false;
case ValID::t_Zero:
// FIXME: LabelTy should not be a first-class type.
diff --git a/llvm/test/Assembler/aggregate-constant-values.ll b/llvm/test/Assembler/aggregate-constant-values.ll
index 3ae356b55dff5c..b208b582a4657a 100644
--- a/llvm/test/Assembler/aggregate-constant-values.ll
+++ b/llvm/test/Assembler/aggregate-constant-values.ll
@@ -26,7 +26,7 @@ define void @bar(ptr %x) nounwind {
}
; CHECK: @bar_empty
-; CHECK: store [0 x i32] undef, ptr %x
+; CHECK: store [0 x i32] poison, ptr %x
; CHECK: ret
define void @bar_empty(ptr %x) nounwind {
store [0 x i32][], ptr %x
diff --git a/llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll b/llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll
index c1a957dec3e867..82832277b1aba4 100644
--- a/llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll
+++ b/llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll
@@ -504,7 +504,7 @@ define amdgpu_kernel void @v2float_stack(ptr addrspace(1) %out, i32 %a) {
}
; OPT-LABEL: @direct_alloca_read_0xi32(
-; OPT: store [0 x i32] undef, ptr addrspace(3)
+; OPT: store [0 x i32] poison, ptr addrspace(3)
; OPT: load [0 x i32], ptr addrspace(3)
define amdgpu_kernel void @direct_alloca_read_0xi32(ptr addrspace(1) %out, i32 %index) {
entry:
``````````
</details>
https://github.com/llvm/llvm-project/pull/119754
More information about the llvm-commits
mailing list