[llvm] [DLCov][NFC] Propagate annotated DebugLocs through transformations (PR #138047)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Wed May 28 04:57:58 PDT 2025
================
@@ -251,8 +259,12 @@ class IRBuilderBase {
/// not on \p Src will be dropped from MetadataToCopy.
void CollectMetadataToCopy(Instruction *Src,
ArrayRef<unsigned> MetadataKinds) {
- for (unsigned K : MetadataKinds)
- AddOrRemoveMetadataToCopy(K, Src->getMetadata(K));
+ for (unsigned K : MetadataKinds) {
+ if (K == LLVMContext::MD_dbg)
+ SetCurrentDebugLocation(Src->getDebugLoc());
----------------
SLTozer wrote:
It should not, if `MetadataKinds` contains `MD_dbg` and `Src` has no loc, then we would call `AddOrRemoveMetadataToCopy(LLVMContext::MD_dbg, nullptr)`, which will remove any `MD_dbg` entry in `MetadataToCopy` - effectively the same thing as this, which overwrites any existing `StoredDL` with an empty debug loc.
https://github.com/llvm/llvm-project/pull/138047
More information about the llvm-commits
mailing list