[llvm] 928460a - [ArgPromotion] Use poison instead of undef as placeholder in deleted metadata [NFC]

Nuno Lopes via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 05:44:51 PST 2024


Author: Nuno Lopes
Date: 2024-11-05T13:44:34Z
New Revision: 928460afc15978df61278337f45eb8c9bcfd13b0

URL: https://github.com/llvm/llvm-project/commit/928460afc15978df61278337f45eb8c9bcfd13b0
DIFF: https://github.com/llvm/llvm-project/commit/928460afc15978df61278337f45eb8c9bcfd13b0.diff

LOG: [ArgPromotion] Use poison instead of undef as placeholder in deleted metadata [NFC]

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
    llvm/test/Transforms/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index ac3f2bab5b096c..d540e6ca86154c 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -336,9 +336,9 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
     }
 
     // There potentially are metadata uses for things like llvm.dbg.value.
-    // Replace them with undef, after handling the other regular uses.
-    auto RauwUndefMetadata = make_scope_exit(
-        [&]() { Arg.replaceAllUsesWith(UndefValue::get(Arg.getType())); });
+    // Replace them with poison, after handling the other regular uses.
+    auto RauwPoisonMetadata = make_scope_exit(
+        [&]() { Arg.replaceAllUsesWith(PoisonValue::get(Arg.getType())); });
 
     if (Arg.use_empty())
       continue;

diff  --git a/llvm/test/Transforms/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll b/llvm/test/Transforms/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll
index 8db0a28e680587..ef362f986182f4 100644
--- a/llvm/test/Transforms/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll
+++ b/llvm/test/Transforms/ArgumentPromotion/pr33641_remove_arg_dbgvalue.ll
@@ -4,7 +4,7 @@
 ; dbg.value which still used the removed argument.
 
 ; The %p argument should be removed, and the use of it in dbg.value should be
-; changed to undef.
+; changed to poison.
 
 %fun_t = type ptr
 define void @foo() {
@@ -15,7 +15,7 @@ define void @foo() {
 
 define internal void @bar(ptr %p) {
 ; CHECK-LABEL: define {{.*}}void @bar()
-; CHECK-NEXT:    #dbg_value(ptr undef, !3, !DIExpression(), !5
+; CHECK-NEXT:    #dbg_value(ptr poison, !3, !DIExpression(), !5
   call void @llvm.dbg.value(metadata ptr %p, metadata !3, metadata !DIExpression()), !dbg !5
   ret void
 }


        


More information about the llvm-commits mailing list