i965: Mark delta_x/y as BAD_FILE if remapped away completely.

Commit afe3d1556f (i965: Stop doing
remapping of "special" regs.) stopped remapping delta_x/delta_y, and
additionally stopped considering them always-live.  We later realized
delta_x was used in register allocaiton, so we actually needed to remap
it, which was fixed in commit 23d782067a
(i965/fs: Keep track of the register that hold delta_x/delta_y.).

However, that commit didn't restore the "always consider it live" part.
If all the code using delta_x was eliminated, fs_visitor::delta_x would
be left pointing at its old register number.  Later code in register
allocation would handle that register number specially...even though it
wasn't actually delta_x.

To combat this, set delta_x/y to BAD_FILE if they're eliminated, and
check for that.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83127
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.3" <mesa-stable@lists.freedesktop.org>
This commit is contained in:
Kenneth Graunke 2014-09-12 17:45:30 -07:00
parent 7f6872d012
commit 78bd126194
2 changed files with 15 additions and 5 deletions

View File

@ -1759,16 +1759,25 @@ fs_visitor::compact_virtual_grfs()
}
/* Patch all the references to delta_x/delta_y, since they're used in
* register allocation.
* register allocation. If they're unused, switch them to BAD_FILE so
* we don't think some random VGRF is delta_x/delta_y.
*/
for (unsigned i = 0; i < ARRAY_SIZE(delta_x); i++) {
if (delta_x[i].file == GRF && remap_table[delta_x[i].reg] != -1) {
delta_x[i].reg = remap_table[delta_x[i].reg];
if (delta_x[i].file == GRF) {
if (remap_table[delta_x[i].reg] != -1) {
delta_x[i].reg = remap_table[delta_x[i].reg];
} else {
delta_x[i].file = BAD_FILE;
}
}
}
for (unsigned i = 0; i < ARRAY_SIZE(delta_y); i++) {
if (delta_y[i].file == GRF && remap_table[delta_y[i].reg] != -1) {
delta_y[i].reg = remap_table[delta_y[i].reg];
if (delta_y[i].file == GRF) {
if (remap_table[delta_y[i].reg] != -1) {
delta_y[i].reg = remap_table[delta_y[i].reg];
} else {
delta_y[i].file = BAD_FILE;
}
}
}
}

View File

@ -459,6 +459,7 @@ fs_visitor::assign_regs(bool allow_spilling)
* that register and set it to the appropriate class.
*/
if (screen->wm_reg_sets[rsi].aligned_pairs_class >= 0 &&
this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC].file == GRF &&
this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC].reg == i) {
c = screen->wm_reg_sets[rsi].aligned_pairs_class;
}