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().
You cannot use -debug in test cases reliably.
Adrian actually specifically suggested a way of testing this, please follow up there before submitting (and for the reviewer, please make sure that other commenters on a patch are OK with proceeding).
I'm going to revert for now as it is breaking bots and any user not building with asserts.