If we've identified another use that isn't scheduled yet, we can break
right away rather than iterating through all the other uses. While this
could be optimized further, this simple change makes
dEQP-VK.subgroups.ballot_broadcast.compute.subgroupbroadcast_ivec4 go
from 40 seconds to 1.9 seconds on a release build according to my
unscientific testing.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11613>
return nearest;
}
-static int
-use_count(struct ir3_instruction *instr)
+static bool
+is_only_nonscheduled_use(struct ir3_instruction *instr, struct ir3_instruction *use)
{
- unsigned cnt = 0;
- foreach_ssa_use (use, instr)
- if (!is_scheduled(use))
- cnt++;
- return cnt;
+ foreach_ssa_use (other_use, instr) {
+ if (other_use != use && !is_scheduled(other_use))
+ return false;
+ }
+
+ return true;
}
/* find net change to live values if instruction were scheduled: */
if (instr->block != src->block)
continue;
- if (use_count(src) == 1)
+ if (is_only_nonscheduled_use(src, instr))
freed_live += dest_regs(src);
}