diff options
| author | Harald van Dijk <harald.vandijk@codeplay.com> | 2024-05-08 11:33:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-08 11:33:47 +0100 |
| commit | 927913fac74b671b5202eb00a52907d8445c7691 (patch) | |
| tree | b50e7b035e7a3cfa9e44ab4abde6c28e37fc62df | |
| parent | 341aecc2dd0f6debcbe9f251a6d2e8a60d327eea (diff) | |
[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.
| -rw-r--r-- | llvm/lib/Transforms/Utils/ValueMapper.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 6ebdd85d37b4..1c877ee937fb 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -538,17 +538,20 @@ Value *Mapper::mapValue(const Value *V) { } void Mapper::remapDbgRecord(DbgRecord &DR) { + // Remap DILocations. + auto *MappedDILoc = mapMetadata(DR.getDebugLoc()); + DR.setDebugLoc(DebugLoc(cast<DILocation>(MappedDILoc))); + if (DbgLabelRecord *DLR = dyn_cast<DbgLabelRecord>(&DR)) { + // Remap labels. DLR->setLabel(cast<DILabel>(mapMetadata(DLR->getLabel()))); return; } DbgVariableRecord &V = cast<DbgVariableRecord>(DR); - // Remap variables and DILocations. + // Remap variables. auto *MappedVar = mapMetadata(V.getVariable()); - auto *MappedDILoc = mapMetadata(V.getDebugLoc()); V.setVariable(cast<DILocalVariable>(MappedVar)); - V.setDebugLoc(DebugLoc(cast<DILocation>(MappedDILoc))); bool IgnoreMissingLocals = Flags & RF_IgnoreMissingLocals; |
