This patch improves the pre-register-allocation portions of MachineSink. Two things happen here -- firstly we collect DBG_VALUEs seen when walking through a machine basic block and record their virtual-register uses, so that it's easy to determine what debuginfo to sink when an instruction sinks. This avoids relying on the unsound collectDebugValues function, and so will collect DBG_VALUEs that don't immediately follow the sunk instruction.
Secondly, debug users of what an instruction defines may no longer be dominated after that instruction sinks (see: the added test case). It's possible to salvage some of these debug users if the sunk instruction was a copy (which can be propagated), and I've added a function to do this.
On a clang-3.4 build we save a fractional number of variable locations and increase covered scope-bytes by ~0.5%.
The copy-propagation to no-longer-dominated instructions makes zero contribution to that coverage improvement -- it's there mostly to ease some test failures that occur when CodeGenPrepare::placeDbgValues is deleted, a patch I will totally upload this week. If the copy-prop part of this patch is dubious, I can fold it into that later patch, where it's easier to see what's going on.