[llvm] [DebugInfo] Preserve line and column number when merging debug info. (PR #129960)

Rahman Lavaee via llvm-commits llvm-commits at lists.llvm.org
Fri May 2 09:34:17 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(),
----------------
rlavaee wrote:

nit: Does `std::forward_as_tuple` work here (to avoid copies)?

https://github.com/llvm/llvm-project/pull/129960


More information about the llvm-commits mailing list