Skip to content

Commit 7e19103

Browse files
authored
[DebugInfo] Map VAM args to poison instead of undef [NFC] (#122756)
If an argument cannot be mapped in `Mapper::mapValue`, it can be mapped to `poison` instead of `undef`.
1 parent 1907a29 commit 7e19103

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/Transforms/Utils/ValueMapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,9 @@ Value *Mapper::mapValue(const Value *V) {
410410
} else if ((Flags & RF_IgnoreMissingLocals) && isa<LocalAsMetadata>(VAM)) {
411411
MappedArgs.push_back(VAM);
412412
} else {
413-
// If we cannot map the value, set the argument as undef.
413+
// If we cannot map the value, set the argument as poison.
414414
MappedArgs.push_back(ValueAsMetadata::get(
415-
UndefValue::get(VAM->getValue()->getType())));
415+
PoisonValue::get(VAM->getValue()->getType())));
416416
}
417417
}
418418
return MetadataAsValue::get(V->getContext(),

llvm/unittests/Transforms/Utils/ValueMapperTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ TEST(ValueMapperTest, mapValueLocalInArgList) {
347347
// such as "metadata i32 %x" don't currently successfully maintain that
348348
// property. To keep RemapInstruction from crashing we need a non-null
349349
// return here, but we also shouldn't reference the unmapped local. Use
350-
// undef for uses in a DIArgList.
351-
auto *N0 = UndefValue::get(Type::getInt8Ty(C));
350+
// poison for uses in a DIArgList.
351+
auto *N0 = PoisonValue::get(Type::getInt8Ty(C));
352352
auto *N0AM = ValueAsMetadata::get(N0);
353353
std::vector<ValueAsMetadata*> N0Elts;
354354
N0Elts.push_back(N0AM);

0 commit comments

Comments
 (0)