Subzero: Fix the simple register allocation for -Om1.
Background: After lowering each high-level ICE instruction, Om1 calls
postLower() to do simple register allocation. It only assigns
registers where absolutely necessary, specifically for infinite-weight
variables, while honoring pre-coloring decisions. The original Om1
register allocation never tried to reuse registers within a lowered
sequence, which was generally OK except for very long lowering
sequences, such as call instructions or some intrinsics. In these
cases, when it ran out of physical registers, it would just reset the
free list and hope for the best, but with no guarantee of correctness.
The fix involves keeping track of which instruction in the lowered
sequence holds the last use of each variable, and releasing each
register back to the free list after its last use. This makes much
better use of registers. It's not necessarily optimal, at least with
respect to pre-colored variables, since those registers are
black-listed even if they don't interfere with an infinite-weight
variable.
BUG= none
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/483453002
3 files changed