Skip to content

Commit 927913f

Browse files
authored
[RemoveDIs] Fix remapping of DbgLabelRecords. (#91447)
We already remapped DILocations for DbgVariableRecords, but DbgLabelRecords have debug locations too that need to be mapped the same way.
1 parent 341aecc commit 927913f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

llvm/lib/Transforms/Utils/ValueMapper.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,17 +538,20 @@ Value *Mapper::mapValue(const Value *V) {
538538
}
539539

540540
void Mapper::remapDbgRecord(DbgRecord &DR) {
541+
// Remap DILocations.
542+
auto *MappedDILoc = mapMetadata(DR.getDebugLoc());
543+
DR.setDebugLoc(DebugLoc(cast<DILocation>(MappedDILoc)));
544+
541545
if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) {
546+
// Remap labels.
542547
DLR->setLabel(cast<DILabel>(mapMetadata(DLR->getLabel())));
543548
return;
544549
}
545550

546551
DbgVariableRecord &V = cast<DbgVariableRecord>(DR);
547-
// Remap variables and DILocations.
552+
// Remap variables.
548553
auto *MappedVar = mapMetadata(V.getVariable());
549-
auto *MappedDILoc = mapMetadata(V.getDebugLoc());
550554
V.setVariable(cast<DILocalVariable>(MappedVar));
551-
V.setDebugLoc(DebugLoc(cast<DILocation>(MappedDILoc)));
552555

553556
bool IgnoreMissingLocals = Flags & RF_IgnoreMissingLocals;
554557

0 commit comments

Comments
 (0)