[llvm] [DebugInfo] Map VAM args to `poison` instead of `undef` (PR #122756)
Pedro Lobo via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 09:59:29 PST 2025
https://github.com/pedroclobo created https://github.com/llvm/llvm-project/pull/122756
If an argument cannot be mapped in `Mapper::mapValue`, it can be mapped to `poison` instead of `undef`.
>From 8cf9742eaaa31351cd395e046a9046e84e20b10e Mon Sep 17 00:00:00 2001
From: Pedro Lobo <pedro.lobo at tecnico.ulisboa.pt>
Date: Mon, 13 Jan 2025 17:41:50 +0000
Subject: [PATCH] [DebugInfo] Map VAM args to `poison` instead of `undef`
If an argument cannot be mapped in `Mapper::mapValue`, it can be mapped
to `poison` instead of `undef`.
---
llvm/lib/Transforms/Utils/ValueMapper.cpp | 4 ++--
llvm/unittests/Transforms/Utils/ValueMapperTest.cpp | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index 3faea48466ba9d..0b57c3bc538c63 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -410,9 +410,9 @@ Value *Mapper::mapValue(const Value *V) {
} else if ((Flags & RF_IgnoreMissingLocals) && isa<LocalAsMetadata>(VAM)) {
MappedArgs.push_back(VAM);
} else {
- // If we cannot map the value, set the argument as undef.
+ // If we cannot map the value, set the argument as poison.
MappedArgs.push_back(ValueAsMetadata::get(
- UndefValue::get(VAM->getValue()->getType())));
+ PoisonValue::get(VAM->getValue()->getType())));
}
}
return MetadataAsValue::get(V->getContext(),
diff --git a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
index d9e63565b809e1..fb1b4edf253287 100644
--- a/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
+++ b/llvm/unittests/Transforms/Utils/ValueMapperTest.cpp
@@ -347,8 +347,8 @@ TEST(ValueMapperTest, mapValueLocalInArgList) {
// such as "metadata i32 %x" don't currently successfully maintain that
// property. To keep RemapInstruction from crashing we need a non-null
// return here, but we also shouldn't reference the unmapped local. Use
- // undef for uses in a DIArgList.
- auto *N0 = UndefValue::get(Type::getInt8Ty(C));
+ // poison for uses in a DIArgList.
+ auto *N0 = PoisonValue::get(Type::getInt8Ty(C));
auto *N0AM = ValueAsMetadata::get(N0);
std::vector<ValueAsMetadata*> N0Elts;
N0Elts.push_back(N0AM);
More information about the llvm-commits
mailing list