This is a rebased version of r276044 / http://reviews.llvm.org/D21885 to current trunk. I had to initially revert, because the commit triggered failures on powerpc (http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/3648).
I need help debugging this! The failing tests are
MultiSource/Benchmarks/mediabench/gsm/toast SingleSource/Benchmarks/Adobe-C++/loop_unroll.cpp
in the test-suite. Given that scavenging happens on all targets in many situations and those two tests on powerpc is the only thing that breaks, I suspect that it is a problem with the commit itself but some pre-existing problem getting triggered, I have no idea what though.
I checked my commit multiple times and dived into assembly diffs with/without this patch without seeing the problem. I need someone with actual access to a Power system to debug this (at least to the point where he can tell me which instructions are generated wrong and why they are wrong).
Original commit message:
This is a variant of scavengeRegister() that works for
enterBasicBlockEnd()/backward(). The benefit of the backward mode is
that it is not affected by incomplete kill flags.
This patch also changes
PrologEpilogInserter::doScavengeFrameVirtualRegs() to use the register
scavenger in backwards mode.