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

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 13:34:17 PDT 2023


dblaikie added a subscriber: hans.
dblaikie added a comment.

> 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?

@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