[LiveDebugValues] Extend var ranges through artificial blocks
authorVedant Kumar <vsk@apple.com>
Fri, 5 Oct 2018 21:44:15 +0000 (21:44 +0000)
committerVedant Kumar <vsk@apple.com>
Fri, 5 Oct 2018 21:44:15 +0000 (21:44 +0000)
commit8c46668b6e0715bd20980b6bb9169359c0811621
tree95f3a0e58c0bdd5ef66f1f511269a2f1ae0737aa
parent9b558380ddd2796be7dd4e350c2682d4a4862ac8
[LiveDebugValues] Extend var ranges through artificial blocks

ASan often introduces basic blocks consisting exclusively of
instructions without debug locations, or with line 0 debug locations.

LiveDebugValues needs to extend variable ranges through these artificial
blocks. Otherwise, a lot of variables disappear -- even at -O0.

Typically, LiveDebugValues does not extend a variable's range into a
block unless the block is essentially "part of" the variable's scope
(for a precise definition, see LexicalScopes::dominates). This patch
relaxes the lexical dominance check for artificial blocks.

This makes the following Swift program debuggable at -O0:
```
  1| var x = 100
  2| print("x = \(x)")
```

rdar://39127144

Differential Revision: https://reviews.llvm.org/D52921

llvm-svn: 343890
llvm/lib/CodeGen/LiveDebugValues.cpp
llvm/test/DebugInfo/AArch64/compiler-gen-bbs-livedebugvalues.ll [new file with mode: 0644]