[llvm] [RemoveDIs] Fix remapping of DbgLabelRecords. (PR #91447)
via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 01:42:53 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Harald van Dijk (hvdijk)
<details>
<summary>Changes</summary>
We already remapped DILocations for DbgVariableRecords, but DbgLabelRecords have debug locations too that need to be mapped the same way.
---
Full diff: https://github.com/llvm/llvm-project/pull/91447.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Utils/ValueMapper.cpp (+6-3)
``````````diff
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index 6ebdd85d37b43..1c877ee937fbf 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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/91447
More information about the llvm-commits
mailing list