Mesa (main): r300: Cache the var list in the peephole_mul_omod() loop.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Dec 8 02:46:11 UTC 2021
Module: Mesa
Branch: main
Commit: 915af8de8b15886c9fe12ff4bed4fa1fbb904464
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=915af8de8b15886c9fe12ff4bed4fa1fbb904464
Author: Emma Anholt <emma at anholt.net>
Date: Tue Dec 7 11:09:06 2021 -0800
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 at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14117>
---
src/gallium/drivers/r300/compiler/radeon_optimize.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/gallium/drivers/r300/compiler/radeon_optimize.c b/src/gallium/drivers/r300/compiler/radeon_optimize.c
index c106d8d74e6..5c825a0a62a 100644
--- a/src/gallium/drivers/r300/compiler/radeon_optimize.c
+++ b/src/gallium/drivers/r300/compiler/radeon_optimize.c
@@ -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;
}
}
}
More information about the mesa-commit
mailing list