Skip to content

Commit c2a2fd2

Browse files
authored
[DebugInfo][RemoveDIs] Allow for inserting DPValues at end() (#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.
1 parent de41396 commit c2a2fd2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/lib/IR/Instruction.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ void Instruction::insertBefore(BasicBlock &BB,
146146
bool InsertAtHead = InsertPos.getHeadBit();
147147
if (!InsertAtHead) {
148148
DPMarker *SrcMarker = BB.getMarker(InsertPos);
149+
if (!SrcMarker)
150+
SrcMarker = BB.createMarker(InsertPos);
149151
DbgMarker->absorbDebugValues(*SrcMarker, false);
150152
}
151153

0 commit comments

Comments
 (0)