[PATCH] D110081: [llvm-profgen] Filter out invalid debug line
Lei Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 1 09:36:14 PDT 2021
wlei added a comment.
In D110081#3035683 <https://reviews.llvm.org/D110081#3035683>, @wenlei wrote:
> In D110081#3028373 <https://reviews.llvm.org/D110081#3028373>, @wlei wrote:
>
>> 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.
>
> Okay, as long as this matches the behavior of original tool, this looks good. I'm also curious how google's tool deal with such negative offset though..
Yeah, it seems like google also ignore those negative offset : https://github.com/google/autofdo/blob/963a8c1f55ed86db6b909ee603a46742b3980139/source_info.h
// Return the offset using the line number and the discriminator.
static constexpr uint64_t GenerateOffset(uint32_t Line,
uint32_t Discriminator) {
return (static_cast<uint64_t>(Line) << 32) |
static_cast<uint64_t>(Discriminator);
}
// Return the line number from the offset.
static constexpr uint32_t GetLineNumberFromOffset(uint64_t Offset) {
return (Offset >> 32) & 0xffff;
}
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