Skip to content

Commit 05589ee

Browse files
authored
[Metadata] Replace undef VAMs with poison VAMs (#129450)
`undef` debug info can be replaced with `poison` debug info.
1 parent 75bfdeb commit 05589ee

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

llvm/lib/IR/Metadata.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ 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
343+
// poison below
343344
SmallVector<UseTy, 8> Uses(MD->UseMap.begin(), MD->UseMap.end());
344345

345346
for (const auto &Pair : Uses) {
@@ -349,7 +350,7 @@ void ReplaceableMetadataImpl::SalvageDebugInfo(const Constant &C) {
349350
// Check for MetadataAsValue.
350351
if (isa<MetadataAsValue *>(Owner)) {
351352
cast<MetadataAsValue *>(Owner)->handleChangedMetadata(
352-
ValueAsMetadata::get(UndefValue::get(C.getType())));
353+
ValueAsMetadata::get(PoisonValue::get(C.getType())));
353354
continue;
354355
}
355356
if (!isa<Metadata *>(Owner))
@@ -359,7 +360,7 @@ void ReplaceableMetadataImpl::SalvageDebugInfo(const Constant &C) {
359360
continue;
360361
if (isa<DINode>(OwnerMD)) {
361362
OwnerMD->handleChangedOperand(
362-
Pair.first, ValueAsMetadata::get(UndefValue::get(C.getType())));
363+
Pair.first, ValueAsMetadata::get(PoisonValue::get(C.getType())));
363364
}
364365
}
365366
}

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)