[llvm] [DebugInfo][RemoveDIs] Allow for inserting DPValues at end() (PR #72379)
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 15 05:22:04 PST 2023
https://github.com/jmorse created https://github.com/llvm/llvm-project/pull/72379
This trivial patch covers a bit of fallout from https://reviews.llvm.org/D153990, where we moved the storage of trailing DPValues into LLVMContext rather than being stored in each block. As a result, you can now get a null DPMarker pointer from the end() iterator where previously you didn't (and now it has to be explicitly created).
This is a sort-of stopgap measure -- there's another all-singing all-dancing patch further down the line that refactors all of this so that we don't allocate a DPMarker for every single Instruction. When that lands this will all be refactored so that every time we request a DPMarker, one is created if needs be. That's a performance-fix rather than a functionality related patch though, so it'll come later.
>From d8eeab38ce544b6ecb38273c6f15113a50ab1943 Mon Sep 17 00:00:00 2001
From: Jeremy Morse <jeremy.morse at sony.com>
Date: Wed, 15 Nov 2023 12:11:46 +0000
Subject: [PATCH] [DebugInfo][RemoveDIs] Allow for inserting DPValues at end()
This patch covers a bit of fallout from https://reviews.llvm.org/D153990,
where we moved the storage of trailing DPValues into LLVMContext rather
than being stored in each block. As a result, you can now get a null
DPMarker pointer from the end() iterator where previously you didn't (and
now it has to be explicitly created).
This is a sort-of stopgap measure -- there's another patch further down the
line that refactors all of this so that we don't allocate a DPMarker for
every single Instruction. When that lands this will all be refactored so
that every time we request a DPMarker, one is created if needs be. That's a
performance-fix rather than a functionality related patch though, so it'll
come later.
---
llvm/lib/IR/Instruction.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 27b2c5ee4d399dc..7449692f05d7bf9 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -146,6 +146,8 @@ void Instruction::insertBefore(BasicBlock &BB,
bool InsertAtHead = InsertPos.getHeadBit();
if (!InsertAtHead) {
DPMarker *SrcMarker = BB.getMarker(InsertPos);
+ if (!SrcMarker)
+ SrcMarker = BB.createMarker(InsertPos);
DbgMarker->absorbDebugValues(*SrcMarker, false);
}
More information about the llvm-commits
mailing list