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

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 10:27:24 PST 2018


aprantl requested changes to this revision.
aprantl added a comment.
This revision now requires changes to proceed.

Thanks! Two comments:

- How are these invalid DBG_VALUEs generated? Are they happening during or after instruction selection? If they are introduced earlier by IR passes, it would be better to catch them in the Verifier and fix the bugs in the passes instead.

- Dropping invalid DBG_VALUE instructions is not correct. What you want to do is insert a `DBG_VALUE undef, ...`. For example:

      ; int x = 0;
      ; ...
      ; x = foo();
      ; ... // x is never used, but not necessarily zero
  
  -->
  
      DBG_VALUE, 0, "x"
      ... 
      DBG_VALUE, noreg, "x"
      ...
      // if you delete the second DBG_VALUE, then "x" will be represented as still being constant 0 here. Inserting a DBG_VALUE undef will correctly terminate the live range of the constant above.


Repository:
  rL LLVM

https://reviews.llvm.org/D43956





More information about the llvm-commits mailing list