Skip to content

Commit 86fc290

Browse files
committed
enable conversion
1 parent 20434bf commit 86fc290

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

llvm/lib/IR/BasicBlock.cpp

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ void BasicBlock::convertToNewDbgValues() {
8181
continue;
8282
}
8383

84+
if (DbgLabelInst *DLI = dyn_cast<DbgLabelInst>(&I)) {
85+
DPVals.push_back(new DPLabel(DLI->getLabel(), DLI->getDebugLoc()));
86+
DLI->eraseFromParent();
87+
continue;
88+
}
89+
8490
if (DPVals.empty())
8591
continue;
8692

@@ -108,15 +114,26 @@ void BasicBlock::convertFromNewDbgValues() {
108114

109115
DPMarker &Marker = *Inst.DbgMarker;
110116
for (DbgRecord &DR : Marker.getDbgValueRange()) {
111-
if (auto *DPV = dyn_cast<DPValue>(&DR))
117+
if (auto *DPV = dyn_cast<DPValue>(&DR)) {
112118
InstList.insert(Inst.getIterator(),
113119
DPV->createDebugIntrinsic(getModule(), nullptr));
114-
else
120+
} else if (auto *DPL = dyn_cast<DPLabel>(&DR)) {
121+
auto *LabelFn =
122+
Intrinsic::getDeclaration(getModule(), Intrinsic::dbg_label);
123+
Value *Args[] = {
124+
MetadataAsValue::get(getModule()->getContext(), DPL->getLabel())};
125+
DbgLabelInst *DbgLabel = cast<DbgLabelInst>(
126+
CallInst::Create(LabelFn->getFunctionType(), LabelFn, Args));
127+
DbgLabel->setTailCall();
128+
DbgLabel->setDebugLoc(DPL->getDebugLoc());
129+
InstList.insert(Inst.getIterator(), DbgLabel);
130+
} else {
115131
llvm_unreachable("unsupported DbgRecord kind");
132+
}
116133
}
117134

118135
Marker.eraseFromParent();
119-
};
136+
}
120137

121138
// Assume no trailing DPValues: we could technically create them at the end
122139
// of the block, after a terminator, but this would be non-cannonical and

0 commit comments

Comments
 (0)