LiveDebugValues propagates variable locations between blocks by creating new DBG_VALUE insts in the successors, then interpreting them when it passes back through the block at a later time. However, this flushes out any extra information about the location that LiveDebugValues holds: for example, connections between variable locations such as discussed in D65368. And as reported in PR42772  this causes us to lose track of the fact that a spill-location is actually a spill, not a register location.
This patch fixes that by deferring the creation of propagated DBG_VALUEs until after propagation has completed: instead location propagation occurs only by sharing location ID numbers between blocks. As a bonus, this reduces a large amount of un-necessary extra DBG_VALUE interpretation, a clang3.4 w/asan build is 1.6% faster for me.
- A collection of "pending" propagated-locations is maintained, and loaded into the OpenRanges object before propagation begins. This replicates the re-interpretation of propagated locations behaviour,
- flushPendingLocs creates DBG_VALUEs from the "pending" collection, but only at the end of the pass,
- "transferTerminator" must now be explicitly called per block, as a block may have neither terminator nor DBG_VALUE insts,
- I've added a file-comment explaining how LiveDebugValues records locations, as it's relatively undocumented right now.
The added test function has a stack-spill in bb.1, which is restored in the exit block bb.3. Current LLVM doesn't recognise the restore because it's lost the fact that the variable location is a spill across the blocks. With this patch, it does recognise it.