[llvm] [DebugInfo] Preserve line and column number when merging debug info. (PR #129960)
Snehasish Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri May 2 13:38:20 PDT 2025
================
@@ -125,6 +132,20 @@ DILocation *DILocation::getMergedLocation(DILocation *LocA, DILocation *LocB) {
if (LocA == LocB)
return LocA;
+ // For some use cases (SamplePGO), it is important to retain distinct source
+ // locations. When this flag is set, we choose arbitrarily between A and B,
+ // rather than computing a merged location using line 0, which is typically
+ // not useful for PGO.
+ if (PickMergedSourceLocations) {
+ auto A = std::make_tuple(LocA->getLine(), LocA->getColumn(),
----------------
snehasish wrote:
No, the only place it would be useful is if `getFilename` and `getDirectory` returned string, but they return StringRef. Also you'd have to rewrite this to do the comparison without the `auto A` and `auto B` vars or you'd introduce lifetime issues if you just replaced `make_tuple` with `forward_as_tuple`.
https://github.com/llvm/llvm-project/pull/129960
More information about the llvm-commits
mailing list