intel/fs/ra: Choose a spill reg before throwing away the graph

Otherwise, we get an effectively random spill reg because we no longer
have the information from RA to guide us.  Also, a completely clean
graph has undefined data in in_stack which is used for choosing the
spill reg so it really is non-deterministic.

Fixes: e99081e76d "intel/fs/ra: Spill without destroying the..."
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Jason Ekstrand
2019-05-14 22:51:20 -05:00
parent c19acf321c
commit b2d274c677

View File

@@ -1157,6 +1157,13 @@ fs_reg_alloc::assign_regs(bool allow_spilling, bool spill_all)
if (!allow_spilling)
return false;
/* Failed to allocate registers. Spill a reg, and the caller will
* loop back into here to try again.
*/
int reg = choose_spill_reg();
if (reg == -1)
return false;
/* If we're going to spill but we've never spilled before, we need to
* re-build the interference graph with MRFs enabled to allow spilling.
*/
@@ -1167,13 +1174,6 @@ fs_reg_alloc::assign_regs(bool allow_spilling, bool spill_all)
spilled = true;
/* Failed to allocate registers. Spill a reg, and the caller will
* loop back into here to try again.
*/
int reg = choose_spill_reg();
if (reg == -1)
return false;
spill_reg(reg);
}