[PATCH] D144337: Prevent line 0 instructions from dividing a lexical block into ranges

ykhatav via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 13:10:43 PDT 2023


ykhatav added a comment.

In D144337#4190626 <https://reviews.llvm.org/D144337#4190626>, @dblaikie wrote:

> In D144337#4185295 <https://reviews.llvm.org/D144337#4185295>, @ykhatav wrote:
>
>> In D144337#4183551 <https://reviews.llvm.org/D144337#4183551>, @dblaikie wrote:
>>
>>> Could you describe why this relates to/depends on the "UnknownLocations" flag? I'm not following from the description - we could still describe these locations as being at line zero, while including them in lexical scopes to avoid fragmented ranges, I think?
>>
>> The reason why we want to check for “UnknownLocations” flag is that this flag is used to check if we want to add line 0 entries in the line table (in DwarfDebug.cpp) and thereby controlling whether or not line zero instructions are represented in the debug information. If we don’t check for this flag and skip the line 0 entries while extracting lexical scopes there will be a mismatch in the line table entries and lexical scopes.
>
> Sorry, still not quite following. Could you walk me through an example of the bug you're trying to address with this patch? And an example of the bug you're trying to avoid introducing/that causes you to need this extra `UnknownLocations` checking?

If you consider the attached test case (llvm/test/DebugInfo/X86/contiguous-lexical-block.ll) you can see that the lexical block is fragmented into ranges due to the presence of an instruction having line number 0. This I believe is a bug and  If the same test case is run on windows, Visual Studio' can't reliably print variable "i"  because CodeView does not provide a mechanism for describing a lexical block with more than one address ranges. In order to prevent the line 0 instructions from breaking up a lexical block, in this patch, we fold the line zero machine instructions into the range. 
I don't have a test case that demonstrates whether using or not using `UnknownLocations` could lead to a bug. It is an internal flag and is suitable for controlling whether or not line zero instructions are represented in the debug information and so, in my opinion, can be used to control the scope tree as well.. Do you have any other flags in mind that can be used instead of "UnknownLocations"?


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

https://reviews.llvm.org/D144337



More information about the llvm-commits mailing list