[llvm] [Assignment Tracking] Change placeholder from `undef` to `poison` (PR #119760)

Pedro Lobo via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 02:03:08 PST 2024


https://github.com/pedroclobo updated https://github.com/llvm/llvm-project/pull/119760

>From e7ffd08398580f453f23e18737d29c42b11862a0 Mon Sep 17 00:00:00 2001
From: Pedro Lobo <pedro.lobo at tecnico.ulisboa.pt>
Date: Thu, 12 Dec 2024 21:04:41 +0000
Subject: [PATCH 1/2] [Assignment Tracking] Change placeholder from `undef` to
 `poison`

Empty metadata address components of `dbg.assign` can be represented as
`poison` values instead of `undef` values.
---
 llvm/lib/IR/IntrinsicInst.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 002bab8e079e50..79795e5691f865 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -223,12 +223,12 @@ void DbgAssignIntrinsic::setAddress(Value *V) {
 void DbgAssignIntrinsic::setKillAddress() {
   if (isKillAddress())
     return;
-  setAddress(UndefValue::get(getAddress()->getType()));
+  setAddress(PoisonValue::get(getAddress()->getType()));
 }
 
 bool DbgAssignIntrinsic::isKillAddress() const {
   Value *Addr = getAddress();
-  return !Addr || isa<UndefValue>(Addr);
+  return !Addr || isa<PoisonValue>(Addr);
 }
 
 void DbgAssignIntrinsic::setValue(Value *V) {

>From 872ce494ee429e8a3a54de7661d79e2d92900f99 Mon Sep 17 00:00:00 2001
From: Pedro Lobo <pedro.lobo at tecnico.ulisboa.pt>
Date: Fri, 13 Dec 2024 09:58:23 +0000
Subject: [PATCH 2/2] [Assignment Tracking] Revert to using `undef` in
 `isKillAddress`

`undef` should continue to be used here to ensure compatibility with
older IR.
---
 llvm/lib/IR/IntrinsicInst.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 79795e5691f865..ad174b1487a643 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -228,7 +228,7 @@ void DbgAssignIntrinsic::setKillAddress() {
 
 bool DbgAssignIntrinsic::isKillAddress() const {
   Value *Addr = getAddress();
-  return !Addr || isa<PoisonValue>(Addr);
+  return !Addr || isa<UndefValue>(Addr);
 }
 
 void DbgAssignIntrinsic::setValue(Value *V) {



More information about the llvm-commits mailing list