[DebugInfo] Map VAM args to poison instead of undef#122756
Merged
nunoplopes merged 1 commit intollvm:mainfrom Jan 13, 2025
Merged
[DebugInfo] Map VAM args to poison instead of undef#122756nunoplopes merged 1 commit intollvm:mainfrom
poison instead of undef#122756nunoplopes merged 1 commit intollvm:mainfrom
Conversation
If an argument cannot be mapped in `Mapper::mapValue`, it can be mapped to `poison` instead of `undef`.
Member
|
@llvm/pr-subscribers-llvm-transforms Author: Pedro Lobo (pedroclobo) ChangesIf an argument cannot be mapped in Full diff: https://github.com/llvm/llvm-project/pull/122756.diff 2 Files Affected:
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);
|
Member
Author
|
cc @nunoplopes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If an argument cannot be mapped in
Mapper::mapValue, it can be mapped topoisoninstead ofundef.