[DebugInfo] Fix bug in LiveDebugVariables.
authorHsiangkai Wang <hsiangkai@gmail.com>
Wed, 5 Sep 2018 05:58:53 +0000 (05:58 +0000)
committerHsiangkai Wang <hsiangkai@gmail.com>
Wed, 5 Sep 2018 05:58:53 +0000 (05:58 +0000)
commitb2b7f5f6d76d256331827f6cbc8e835282f30ed5
treea99ad5abf24fa948a8ced7de72980b222ba1a4ad
parentc3d1d107ffad20d33f5088ced13482a0ea7dd53f
[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: 341446
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]