[PATCH] D110081: [llvm-profgen] Filter out invalid debug line

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 12:43:08 PDT 2021


wlei added a comment.

In D110081#3010969 <https://reviews.llvm.org/D110081#3010969>, @wenlei wrote:

> I think I've seen negative line offsets due to use of macro. If macro is used the line info may point to location where the macro is defined, then it can lead to negative line offset if we use function start line as the base.
>
> In such cases, negative offset should still work for correlating profile back to IR.. What is the corresponding line offset you saw on relevant IR? Do they match the offset in the profile?

As we discussed offline, we might have the invalid number in non-macro case and our internal tools also haven't covered this which can be a separate improvements later.



================
Comment at: llvm/test/tools/llvm-profgen/cs-preinline.test:13
 
-; CHECK-DEFAULT:     [main:1 @ foo]:309:0
+; CHECK-DEFAULT:     [main:1 @ foo]:225:0
 ; CHECK-DEFAULT-NEXT: 2.1: 14
----------------
hoy wrote:
> Wondering what is causing the total sample to change but the body samples stay the same? The lines filtered out should not have mapped to the same context previously?
Sorry for the late reply.

This is because previously we add total sample even it's an invalid line number. With current change, the invalid line is filtered out at the early stage, so we then won't have them sum to the total number. This is causing the difference.

I think it should be minor impact by the difference since the invalid line is rare and total number itself is kind of a estimation(like it counts against all instructions but not the source code) 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110081/new/

https://reviews.llvm.org/D110081



More information about the llvm-commits mailing list