Skip to content

Commit 66b5a4c

Browse files
committed
[Metadata] Replace undef VAMs with poison VAMs
`undef` debug info can be replaced with `poison` debug info.
1 parent f5f5286 commit 66b5a4c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/IR/Metadata.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void ReplaceableMetadataImpl::SalvageDebugInfo(const Constant &C) {
339339
ValueAsMetadata *MD = I->second;
340340
using UseTy =
341341
std::pair<void *, std::pair<MetadataTracking::OwnerTy, uint64_t>>;
342-
// Copy out uses and update value of Constant used by debug info metadata with undef below
342+
// Copy out uses and update value of Constant used by debug info metadata with poison below
343343
SmallVector<UseTy, 8> Uses(MD->UseMap.begin(), MD->UseMap.end());
344344

345345
for (const auto &Pair : Uses) {
@@ -349,7 +349,7 @@ void ReplaceableMetadataImpl::SalvageDebugInfo(const Constant &C) {
349349
// Check for MetadataAsValue.
350350
if (isa<MetadataAsValue *>(Owner)) {
351351
cast<MetadataAsValue *>(Owner)->handleChangedMetadata(
352-
ValueAsMetadata::get(UndefValue::get(C.getType())));
352+
ValueAsMetadata::get(PoisonValue::get(C.getType())));
353353
continue;
354354
}
355355
if (!isa<Metadata *>(Owner))
@@ -359,7 +359,7 @@ void ReplaceableMetadataImpl::SalvageDebugInfo(const Constant &C) {
359359
continue;
360360
if (isa<DINode>(OwnerMD)) {
361361
OwnerMD->handleChangedOperand(
362-
Pair.first, ValueAsMetadata::get(UndefValue::get(C.getType())));
362+
Pair.first, ValueAsMetadata::get(PoisonValue::get(C.getType())));
363363
}
364364
}
365365
}

llvm/test/DebugInfo/X86/undef-dbg-val.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; RUN: opt -S -passes=globalopt --experimental-debuginfo-iterators=false <%s | FileCheck %s
2-
; CHECK: #dbg_value(ptr undef,
2+
; CHECK: #dbg_value(ptr poison,
33
; CHECK-SAME: [[VAR:![0-9]+]],
44
; CHECK-SAME: !DIExpression()
55
; CHECK: [[VAR]] = !DILocalVariable(name: "_format"

0 commit comments

Comments
 (0)