Add an improved/new heuristic to catch more cases when values are not live out of a basic block.
I see regressions with this one after some possibly recent commits? In the first test case in test/CodeGen/AMDGPU/basic-branch.ll, it seems to not detect the use of the pointer value and omits the spill. The restore is still present
Typo, extra c in Across
This is broken because it's skipping the first use. It can also useMRI->reg_nodbg_instructions.
This is also broken for the case where there is a phi/copy when there is a loop back to the same block. This needs to check for whether the use instruction happens before the spilled value def
Fix use scan skipping first use. Assume live-out if block is its own successor.
Update tests. Not sure what's going on with test/DebugInfo/X86/pieces-1.ll, but I doubt it's testing what it's supposed to
LGTM. Nitpicks below.
The typo is in the comment is still here :).
Just a thought, given that we already traversed all the instructions of MBB at this point, we could avoid this loop all together by checking if we saw as many uses as the total number of uses for each virtual register.
Bonus, if we were to do that, we would know what the status for the back-edges case.
Anyhow, nothing to do here!