[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
Thu Mar 16 16:00:15 PDT 2023


ykhatav added a comment.

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

>> 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.
>
> Sure, I'm on-board there. I'll take your word for it that CV can't represent discontiguous scopes and making scopes contiguous is the better tradeoff than omitting them entirely.
>
>> 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"?
>
> I don't understand this bit - there can be zero locations for other reasons, apart from `UnknownLocations` - you could just check for the zero locations, without needing to check `UnknownLocations` too, right?
>
> But maybe you're using `UnknownLocations` as a proxy for CV/MSVC debug info emission? That seems unfortunate/not suitable, and this behavior should be gated on/more directly test for CV output, I think?

No, my intent was not to use `UnknownLocations` as a proxy for CV, but I think it is safe not to fold line 0 instructions into a scope range when `UnknownLocations` is enabled. AFAIK, when `UnknownLocations` is enabled line 0 entries are emitted in the debug information. In my opinion, Folding these instructions when the switch is enabled could break stuff.

> @hans maybe you've got thoughts on this stuff




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

https://reviews.llvm.org/D144337



More information about the llvm-commits mailing list