[DebugInfo] Fix bug in LiveDebugVariables.
authorHsiangkai Wang <hsiangkai@gmail.com>
Sun, 2 Sep 2018 15:57:22 +0000 (15:57 +0000)
committerHsiangkai Wang <hsiangkai@gmail.com>
Sun, 2 Sep 2018 15:57:22 +0000 (15:57 +0000)
commit1368434b4973918b04b406633ce28d4e41481e8d
tree57d73c2a3d16cb52999f94d958dc0701683caad9
parentca36eb4e33e487d8ae0e77fd38218a73c8656433
[DebugInfo] Fix bug in LiveDebugVariables.

In lib/CodeGen/LiveDebugVariables.cpp, it uses std::prev(MBBI) to
get DebugValue's SlotIndex. However, the previous instruction may be
also a debug instruction. It could not use a debug instruction to query
SlotIndex in mi2iMap.

Scan all debug instructions and use the first debug instruction to query
SlotIndex for following debug instructions. Only handle DBG_VALUE in
handleDebugValue().

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

llvm-svn: 341289
llvm/include/llvm/CodeGen/SlotIndexes.h
llvm/lib/CodeGen/LiveDebugVariables.cpp
llvm/test/DebugInfo/X86/live-debug-vars-index.mir [new file with mode: 0644]