[PATCH] D43956: [DebugInfo] Discard invalid DBG_VALUE instructions in LiveDebugVariables

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 2 09:48:28 PST 2018


bjope added a comment.

In https://reviews.llvm.org/D43956#1025531, @aprantl wrote:

> > But maybe it is a bug that LiveDebugVariables removes all DBG_VALUE undef, ...?
>
> I think it is.
>
> If you compile the function at -O1 (to force the constant to be described with a dbg.value)
>
>   void foo() {
>     // single basic block
>     int x = 42;
>     bar();
>     x = 23;
>     bar();
>   }
>
>
> and replace the second dbg.value with a dbg.value(undef) in the LLVM IR and run it through llc, do we get the range of the constant 42 correct in the resulting location list for x? Does it end before the second call to bar()?


Nope, if I do that the DBG_VALUE is removed by LiveDebugVariables. And we no longer get a .debug_loc range for "x". Instead we get

  	.byte	3                       # Abbrev [3] 0x3f:0xc DW_TAG_variable
  	.byte	42                      # DW_AT_const_value
  	.long	.Linfo_string4          # DW_AT_name
  	.byte	1                       # DW_AT_decl_file
  	.byte	5                       # DW_AT_decl_line
  	.long	76                      # DW_AT_type

So "x" will appear as being 42 throughout the function.


Repository:
  rL LLVM

https://reviews.llvm.org/D43956





More information about the llvm-commits mailing list