r300: Cache the var list in the peephole_mul_omod() loop.

If we're not making progress (which the function was already giving us!),
then there's no need to recompute the list.  Reduces
pixmark-piano/7.shader_test compile time from 50 seconds to 10.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14117>
This commit is contained in:
Emma Anholt 2021-12-07 11:09:06 -08:00 committed by Marge Bot
parent 42e8f48be7
commit 915af8de8b
1 changed files with 5 additions and 3 deletions

View File

@ -881,7 +881,6 @@ static int peephole(struct radeon_compiler * c, struct rc_instruction * inst)
void rc_optimize(struct radeon_compiler * c, void *user)
{
struct rc_instruction * inst = c->Program.Instructions.Next;
struct rc_list * var_list;
while(inst != &c->Program.Instructions) {
struct rc_instruction * cur = inst;
inst = inst->Next;
@ -902,12 +901,15 @@ void rc_optimize(struct radeon_compiler * c, void *user)
}
inst = c->Program.Instructions.Next;
struct rc_list * var_list = NULL;
while(inst != &c->Program.Instructions) {
struct rc_instruction * cur = inst;
inst = inst->Next;
if (cur->U.I.Opcode == RC_OPCODE_MUL) {
var_list = rc_get_variables(c);
peephole_mul_omod(c, cur, var_list);
if (!var_list)
var_list = rc_get_variables(c);
if (peephole_mul_omod(c, cur, var_list))
var_list = NULL;
}
}
}