aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorPedro Lobo <pedro.lobo@tecnico.ulisboa.pt>2025-03-03 00:17:01 +0000
committerGitHub <noreply@github.com>2025-03-03 07:17:01 +0700
commit3c80d9b8dda38162016f72defe24baf79d4cf0ef (patch)
tree78b3b3a84bcc7ec27ee6c494513be82dcc394029 /llvm/lib
parentd1fd3698a9b755250f622fd1b14c57a27e2a9d77 (diff)
downloadllvm-3c80d9b8dda38162016f72defe24baf79d4cf0ef.zip
llvm-3c80d9b8dda38162016f72defe24baf79d4cf0ef.tar.gz
llvm-3c80d9b8dda38162016f72defe24baf79d4cf0ef.tar.bz2
[Instruction] Set metadata to `poison` on deletion (#129449)
Represent extant metadata uses of a deleted instruction with `poison` instead of `undef`.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Instruction.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 7d43de9..4eadecb 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -48,7 +48,7 @@ Instruction::Instruction(Type *ty, unsigned it, AllocInfo AllocInfo,
Instruction::~Instruction() {
assert(!getParent() && "Instruction still linked in the program!");
- // Replace any extant metadata uses of this instruction with undef to
+ // Replace any extant metadata uses of this instruction with poison to
// preserve debug info accuracy. Some alternatives include:
// - Treat Instruction like any other Value, and point its extant metadata
// uses to an empty ValueAsMetadata node. This makes extant dbg.value uses
@@ -58,7 +58,7 @@ Instruction::~Instruction() {
// correct. OTOH results in wasted work in some common cases (e.g. when all
// instructions in a BasicBlock are deleted).
if (isUsedByMetadata())
- ValueAsMetadata::handleRAUW(this, UndefValue::get(getType()));
+ ValueAsMetadata::handleRAUW(this, PoisonValue::get(getType()));
// Explicitly remove DIAssignID metadata to clear up ID -> Instruction(s)
// mapping in LLVMContext.