Skip to content

Commit 2f7c050

Browse files
committed
[DebugInfo][RemoveDIs] Allow speculative-DPMarker creation
There's good justification for having a function specifying "I need there to be a marker here, so return the marker there or create a new one". This was going to come later in the series, but it's starting to become necessary much eariler alas. Make use of it in spliceDebugInfo, where we can occasionally splice DPValues onto the end() iterator of a block while it's been edited.
1 parent 5e5a22c commit 2f7c050

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/IR/BasicBlock.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ cl::opt<bool>
3939
DPMarker *BasicBlock::createMarker(Instruction *I) {
4040
assert(IsNewDbgInfoFormat &&
4141
"Tried to create a marker in a non new debug-info block!");
42-
assert(I->DbgMarker == nullptr &&
43-
"Tried to create marker for instuction that already has one!");
42+
if (I->DbgMarker)
43+
return I->DbgMarker;
4444
DPMarker *Marker = new DPMarker();
4545
Marker->MarkedInstr = I;
4646
I->DbgMarker = Marker;
@@ -918,8 +918,8 @@ void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src,
918918
// move their markers onto Last. They remain in the Src block. No action
919919
// needed.
920920
if (!ReadFromHead) {
921-
DPMarker *OntoLast = Src->getMarker(Last);
922-
DPMarker *FromFirst = Src->getMarker(First);
921+
DPMarker *OntoLast = Src->createMarker(Last);
922+
DPMarker *FromFirst = Src->createMarker(First);
923923
OntoLast->absorbDebugValues(*FromFirst,
924924
true); // Always insert at head of it.
925925
}

0 commit comments

Comments
 (0)