@@ -81,6 +81,12 @@ void BasicBlock::convertToNewDbgValues() {
81
81
continue ;
82
82
}
83
83
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
+
84
90
if (DPVals.empty ())
85
91
continue ;
86
92
@@ -108,15 +114,26 @@ void BasicBlock::convertFromNewDbgValues() {
108
114
109
115
DPMarker &Marker = *Inst.DbgMarker ;
110
116
for (DbgRecord &DR : Marker.getDbgValueRange ()) {
111
- if (auto *DPV = dyn_cast<DPValue>(&DR))
117
+ if (auto *DPV = dyn_cast<DPValue>(&DR)) {
112
118
InstList.insert (Inst.getIterator (),
113
119
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 {
115
131
llvm_unreachable (" unsupported DbgRecord kind" );
132
+ }
116
133
}
117
134
118
135
Marker.eraseFromParent ();
119
- };
136
+ }
120
137
121
138
// Assume no trailing DPValues: we could technically create them at the end
122
139
// of the block, after a terminator, but this would be non-cannonical and
0 commit comments