From: Jason Ekstrand Date: Wed, 15 May 2019 03:51:20 +0000 (-0500) Subject: intel/fs/ra: Choose a spill reg before throwing away the graph X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b2d274c6775003e8b6b4aa015a2d8c336fed6fdc;p=mesa.git 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: e99081e76d4 "intel/fs/ra: Spill without destroying the..." Tested-by: Ian Romanick Reviewed-by: Kenneth Graunke --- diff --git a/src/intel/compiler/brw_fs_reg_allocate.cpp b/src/intel/compiler/brw_fs_reg_allocate.cpp index b7425ea6d58..33631ddcd0c 100644 --- a/src/intel/compiler/brw_fs_reg_allocate.cpp +++ b/src/intel/compiler/brw_fs_reg_allocate.cpp @@ -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); }