[llvm] [BOLT] Fix debug line emission for functions in multiple compilation units (PR #151230)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 11:04:15 PDT 2025


================
@@ -1697,22 +1693,41 @@ void BinaryContext::preprocessDebugInfo() {
 
     auto It = llvm::partition_point(
         AllRanges, [=](CURange R) { return R.HighPC <= FunctionAddress; });
-    if (It != AllRanges.end() && It->LowPC <= FunctionAddress)
-      Function.setDWARFUnit(It->Unit);
+    if (It == AllRanges.end() || It->LowPC > FunctionAddress) {
+      continue;
+    }
+    Function.addDWARFUnit(It->Unit);
+
+    // Go forward and add all units from ranges that cover the function
+    while (++It != AllRanges.end()) {
+      if (It->LowPC <= FunctionAddress && FunctionAddress < It->HighPC) {
----------------
ayermolo wrote:

simplify logic

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


More information about the llvm-commits mailing list