[DebugInfo] Replace UndefValue with PoisonValue in DIArgList::handleChangedOperand
authorOCHyams <orlando.hyams@sony.com>
Tue, 25 Apr 2023 14:39:31 +0000 (15:39 +0100)
committerOCHyams <orlando.hyams@sony.com>
Tue, 25 Apr 2023 15:18:41 +0000 (16:18 +0100)
This helps towards the effort to remove UndefValue from LLVM.

Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value

Reviewed By: nlopes

Differential Revision: https://reviews.llvm.org/D140991

llvm/lib/IR/DebugInfoMetadata.cpp
llvm/test/Transforms/GlobalOpt/deadglobal-diarglist-use.ll

index a5da64e..667cca3 100644 (file)
@@ -2093,7 +2093,7 @@ void DIArgList::handleChangedOperand(void *Ref, Metadata *New) {
       if (NewVM)
         VM = NewVM;
       else
-        VM = ValueAsMetadata::get(UndefValue::get(VM->getValue()->getType()));
+        VM = ValueAsMetadata::get(PoisonValue::get(VM->getValue()->getType()));
     }
   }
   if (Uniq) {
index 4b39692..f077e00 100644 (file)
@@ -6,7 +6,7 @@
 
 ; CHECK-NOT: @s
 
-; CHECK: call void @llvm.dbg.value(metadata !DIArgList(ptr undef
+; CHECK: call void @llvm.dbg.value(metadata !DIArgList(ptr poison
 
 %struct.S = type { i32 }