-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[AsmParser] Convert empty arrays to poison
#119754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Empty arrays can be converted to `poison` instead of `undef`.
|
@llvm/pr-subscribers-backend-amdgpu Author: Pedro Lobo (pedroclobo) ChangesEmpty arrays can be converted to Full diff: https://github.com/llvm/llvm-project/pull/119754.diff 3 Files Affected:
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:
|
nikic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/174/builds/10000 Here is the relevant piece of the build log for the reference |
Empty arrays can be converted to
poisoninstead ofundef.