Skip to content

Commit 928460a

Browse files
committed
[ArgPromotion] Use poison instead of undef as placeholder in deleted metadata [NFC]
1 parent f0231b6 commit 928460a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,9 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
336336
}
337337

338338
// There potentially are metadata uses for things like llvm.dbg.value.
339-
// Replace them with undef, after handling the other regular uses.
340-
auto RauwUndefMetadata = make_scope_exit(
341-
[&]() { Arg.replaceAllUsesWith(UndefValue::get(Arg.getType())); });
339+
// Replace them with poison, after handling the other regular uses.
340+
auto RauwPoisonMetadata = make_scope_exit(
341+
[&]() { Arg.replaceAllUsesWith(PoisonValue::get(Arg.getType())); });
342342

343343
if (Arg.use_empty())
344344
continue;

llvm/test/Transforms/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
; dbg.value which still used the removed argument.
55

66
; The %p argument should be removed, and the use of it in dbg.value should be
7-
; changed to undef.
7+
; changed to poison.
88

99
%fun_t = type ptr
1010
define void @foo() {
@@ -15,7 +15,7 @@ define void @foo() {
1515

1616
define internal void @bar(ptr %p) {
1717
; CHECK-LABEL: define {{.*}}void @bar()
18-
; CHECK-NEXT: #dbg_value(ptr undef, !3, !DIExpression(), !5
18+
; CHECK-NEXT: #dbg_value(ptr poison, !3, !DIExpression(), !5
1919
call void @llvm.dbg.value(metadata ptr %p, metadata !3, metadata !DIExpression()), !dbg !5
2020
ret void
2121
}

0 commit comments

Comments
 (0)